[Zope] ZSQL method LAST_INSERT_ID() error

Andrew Williams ajwms91@hotmail.com
Tue, 13 Mar 2001 12:02:50 -0500


I know I'm coming into this thread a little late, but...

I've run across the same problem you described.  I figured out that adding a 
semicolon at the end of my SQL statements was causing the syntax error. IE:

SELECT * from t_table
WHERE keyfield=<dtml-sqlvar keyfield type=string>;

gave me the syntax error.

When I removed the semicolon everything worked fine.

Of course, you can also set the limit clause to zero, but you might now want 
to have to to do that.


Andrew Williams


>From: Paul Zwarts <paul.zwarts@oratrix.com>
>To: Andy Dustman <andy@dustman.net>
>CC: paul_s_johnson@urscorp.com, zope@zope.org
>Subject: Re: [Zope] ZSQL method LAST_INSERT_ID() error
>Date: Tue, 13 Mar 2001 17:19:32 +0100
>
>Hi,
>Can this be done to a whole folder of sqlstatements at once? Or is this an 
>object
>specific thing?
>
>Paz
>
>Andy Dustman wrote:
>
> > http://www.zope.org/Members/adustman/Tips/no_limits
> >
> > On Tue, 13 Mar 2001 paul_s_johnson@urscorp.com wrote:
> >
> > > This ZSQL query:
> > >
> > >      SELECT LAST_INSERT_ID() AS ID
> > >
> > > Is returning this error:
> > >
> > >       Error, _mysql.OperationalError: (1064, "You have an error in 
>your SQL
> > > syntax near 'LIMIT 1000' at line 1")
> > >
> > > It apparently automatically adds a LIMIT clause to the end of my SQL 
>query
> > > that MySQL does not like in this context.  Is there any way to shut 
>the
> > > limit clause off?  Anybody have any ideas for a workaround?
> >
> > --
> > Andy Dustman         PGP: 0xC72F3F1D
> >     @       .net     http://dustman.net/andy
> > "Normally with carbonara you use eggs, but I used lobster brains 
>instead."
> >     -- Masahiko Kobe (Iron Chef Italian): 30-year-old Giant Lobster 
>Battle
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com