Re: [Zope] ZSQL Method Question

2006-07-19 Thread John Schinnerer
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

Re: [Zope] ZSQL Method Question

2006-07-18 Thread Cliff Ford
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

Re: [Zope] ZSQL Method Question

2006-07-18 Thread Peter Bengtsson
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

Re: [Zope] ZSQL Method Question

2006-07-18 Thread Tino Wildenhain
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 =

Re: [Zope] ZSQL Method Question

2006-07-18 Thread John Schinnerer
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

Re: [Zope] ZSQL Method Question

2006-07-18 Thread Cliff Ford
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

Re: [Zope] ZSQL Method Question

2006-07-17 Thread Jonathan
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