Skip site navigation (1) Skip section navigation (2)

Re: last value[Scanned]

From: Pawel Bernat <asm(at)vlo(dot)olsztyn(dot)pl>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: last value[Scanned]
Date: 2005-05-05 07:57:18
Message-ID: 20050505095718.A26850@vlo (view raw or flat)
Thread:
Lists: pgsql-php
On Wed, May 04, 2005 at 04:39:27PM -0300, Roni Warken wrote:
> Right Pawel! If I get the current value, my DB could crash in the next
> insertion.
> 
> What about the trigger? Where do I get some examples to practice?but
It all depends on your needs :)
To save data integrity, you have at least three basic solutions:
a) put all queries into transaction. If someting fails in next
step, first insert will be canceled,
b) write a stored procedure (containing all necessary queries)
in a database side, and call this proc in your application,
c) create trigger on table - if your second query doesn't need
extra parameters coming from application.

Samples for a) and b) are in the documentation / examples in postgres
package. You have to choose a procedural language first (PHP is available).

-- 
PaweĊ‚ Bernat; uselessness' lover;
select'<asm'||chr(64)||'asm'||'.'||'flynet'||chr(46)||'pl>'as email;
Slowly and surely the unix crept up on the Nintendo user ...

In response to

pgsql-php by date

Next:From: Ninad KalamkarDate: 2005-05-09 05:23:37
Subject: Promlem to database from PHP
Previous:From: Andrew J. KopciuchDate: 2005-05-05 07:22:02
Subject: Re: Tutorial about PHP and PostgreSQL Programming

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group