Aloha,
I think so, for the moment anyhow!
Thanks all,
John S.
Cliff Ford wrote:
Comment on Peter's suggestion: I am no expert on these things, but it is
my understanding that for MySQL LAST_INSERT_ID() fetches the last
autoincrement value made by the current insert, so the outcome is not
This is how it works for MySQL:
insert into org (org_name, org_phone) values ('x', 'y')
dtml-var sql_delimiter
select LAST_INSERT_ID() as org_id
You have to have the select LAST_INSERT_ID call in the same query as the
insert, and you have to have the sql_delimiter.
I assume you know that the
What if you have 1,000,000 requests/sec?
What if between the INSERT and the LAST_INSERT_ID() another INSERT is made?
I use PostgreSQL and with postgres you can always ask the sequence what
the next id is going to be. It goes something like this::
next_id = context.GetNextId()[0].next_id
Peter Bengtsson wrote:
What if you have 1,000,000 requests/sec?
What if between the INSERT and the LAST_INSERT_ID() another INSERT is made?
I use PostgreSQL and with postgres you can always ask the sequence what
the next id is going to be. It goes something like this::
next_id =
Aloha,
Is this even easier solution only for postgreSQL, or is it for MySQL?
I am going to have to start working with integrating MySQL into
zope-based stuff soon so I'm trying to get a head start... :-)
thanks,
John S.
Tino Wildenhain wrote:
Peter Bengtsson wrote:
What if you have
Comment on Peter's suggestion: I am no expert on these things, but it is
my understanding that for MySQL LAST_INSERT_ID() fetches the last
autoincrement value made by the current insert, so the outcome is not
affected by virtually simultaneous requests. And I don't think MySQL
accepts a value
when you do an insert with a ZSQL method you do not
get back any info from mysql, you need to do a subsequent search to get
'autogenerated' columns. So do your insert, then do an ZSQL search.
The search returns a 'Results' object which has several methods you can use to
get at the search