[Zope] ZMySQLDA and LAST_INSERT_ID() under heavy load

Ragnar Beer rbeer1 at uni-goettingen.de
Fri Sep 3 06:25:17 EDT 2004


That's good news. Thank you, Andy!

On Thu, 2 Sep 2004 13:45:45 -0400
Andy Dustman <farcepest at gmail.com> wrote:

> On Thu, 2 Sep 2004 18:48:27 +0200, Ragnar Beer
> <rbeer1 at uni-goettingen.de> wrote:
> > LAST_INSERT_ID() in MySQL returns the number of the last automatically
> > generated autoincrement value on a per-connection basis. Now, as far
> > as I understand, when using ZMySQLDA all queries share one connection
> > which saves a lot of time, because it is not necessary to open a new
> > connection for each and every statement.
> 
> No, the DA mechanisms create one connection per thread, so
> LAST_INSERT_ID() should be safe. I do recommend incorporating this
> into the same Z SQL Method as your INSERT. Note that you must separate
> SQL statements in a Z SQL Method with <dtml-var sql_delimiter>.
> 
> http://www.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.1.4.4.html
> 
> In other words:
> 
> INSERT .... into blah
> <dtml-var sql_delimiter>
> SELECT LAST_INSERT_ID()
> 
> sql_delimiter is actually a null character (\0) as I recall used by
> the DA to split up statements.
> -- 
> Computer interfaces should never be made of meat.
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 




More information about the Zope mailing list