From: Pawel Bernat <asm@vlo.olsztyn.pl>
To: pgsql-php@postgresql.org
Subject: Re: last value[Scanned]
Date: Thu, 5 May 2005 09:57:18 +0200
Message-ID: <20050505095718.A26850@vlo> (raw)
In-Reply-To: <d4af7dcf05050412397efaac02@mail.gmail.com>
References: <6FE0AEF8FBBD124D8CF3DD26064A096A1222E6@MMDELL.mm.local>
<20050504153312.A24041@vlo>
<d4af7dcf05050412397efaac02@mail.gmail.com>
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 ...
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: asm@vlo.olsztyn.pl
Subject: Re: last value[Scanned]
In-Reply-To: <20050505095718.A26850@vlo>
References: <6FE0AEF8FBBD124D8CF3DD26064A096A1222E6@MMDELL.mm.local> <20050504153312.A24041@vlo> <d4af7dcf05050412397efaac02@mail.gmail.com> <20050505095718.A26850@vlo>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox