[Zope] atomic operations
Gustavo Vieira Goncalves Coelho Rios
gustavo@ifour.com.br
Thu, 26 Jul 2001 19:03:09 -0300
On Thu, Jul 26, 2001 at 08:59:25PM +0200, Danni Efraim wrote:
>I am only a MySQL-novice, so correct me if I am wrong, but as long as your=
=20
>Zope instances have separate connections, shouldn't last_insert_id() retur=
n=20
>the last inserted id of that particular session, and thus be safe anyhow?
>
>If not, how about using transactions, or (icky icky yuk!) locking the tabl=
e?
I asked this cause' i though it could be possible zope start executing a sc=
ript, stop before its end and switch to another one, finishes this one and =
come back to the old one. So if there are insert queries into both of them,=
the first one would fetch a wrong last_insert_id(), got the ideia?
Does this happen when using a cluster of servers (ZEO)?
May some one explain me if such scenario may happen!
>And finally, wouldn't such a question be better asked on a MySQL-list?
>
>/Danni
>
>> Hi folks!
>>
>> I have a table it has an auto increment fields. How could i have the id =
id
>> insert by my last query atomically? I know i could use last_insert_id()
>> function with MySQL, but since my mysql handler is shared by many instan=
ces
>> of Zope, i cannot garantee that no other query runs between the insert a=
nd
>> the select last_insert_id queries.
>>
>> Any ideia ?
>
--=20
"Of ______=08=08=08=08=08=08course it's the murder weapon. Who would frame=
someone with a
fake?"