pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: last value[Scanned]
2+ messages / 1 participants
[nested] [flat]

* Re: last value[Scanned]
@ 2005-05-04 13:33  Pawel Bernat <asm@vlo.olsztyn.pl>
  0 siblings, 1 reply; 2+ messages in thread

From: Pawel Bernat @ 2005-05-04 13:33 UTC (permalink / raw)
  To: pgsql-php

On Wed, May 04, 2005 at 02:23:31PM +0100, Simon Hewitt wrote:
> Hi Pawel,
(...)
> Note that this returns the latest value in *your* database session. i.e. If someone has inserted a row between your insert and retrieving the sequence number you will still receive *your*  value
And it's exact value, that Rony needs.

p.
-- 
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 ...



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: last value[Scanned]
@ 2005-05-05 07:57  Pawel Bernat <asm@vlo.olsztyn.pl>
  parent: Pawel Bernat <asm@vlo.olsztyn.pl>
  0 siblings, 0 replies; 2+ messages in thread

From: Pawel Bernat @ 2005-05-05 07:57 UTC (permalink / raw)
  To: 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 ...



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-05-05 07:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-04 13:33 Re: last value[Scanned] Pawel Bernat <asm@vlo.olsztyn.pl>
2005-05-05 07:57 ` Pawel Bernat <asm@vlo.olsztyn.pl>

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