[Zope] ZSQL Methods and SELECT functions
Carlos Costa Portela
ccosta@servidores.net
Sun, 17 Mar 2002 01:40:47 +0100 (CET)
On Sat, 16 Mar 2002, Robert Ln wrote:
> Hi all,
> 4) Finally, the mysql docs say the last_insert_id() returns the last
> automatically generated id on a per-connection basis. If in zope
> only a single connection is made and a lot of clients are accessing
> it at once, how do I guarantee I get back the correct id? I thought
> you could concatenate multiple SQL queries in one zsql method, but
> that doesnt seem to work anymore.
=09I think that this is not a only-Zope question, but a database one.
One approach can be:
=09a. get the next_id (example: "select nextval from table");
=09b. use this id to insert the new row.
=09So you can guarantee that you know what id are you using.
=09Hope this helps,
=09=09Carlos.
[ all about zope+web : http://www.improveyourweb.com ]
_______Carlos Costa Portela_______________________________________________=
__
| e-mail: ccosta@servidores.net | home page: http://casa.ccp.servidores.ne=
t |
|_____T=F3dalas persoas maiores foron nenos antes, pero poucas se lembran__=
____|