[Zope] sql_delimiter broken?

Tino Wildenhain tino at wildenhain.de
Tue Jan 25 12:48:44 EST 2005


Am Dienstag, den 25.01.2005, 10:01 -0500 schrieb Andy Dustman:
> On Tue, 25 Jan 2005 06:52:10 +0100, Tino Wildenhain <tino at wildenhain.de> wrote:
> > Am Montag, den 24.01.2005, 15:04 -0700 schrieb hpinson at indepthl.com:
> > > The ability to pass multiple sql calls in one ZSQL method using
> > > sql_delimiter seems to be broken in 2.7.4.
> > >
> > > This no longer works in a single ZSQL method:
> > >
> > > INSERT INTO ...;
> > > <dtml-var sql_delimiter>
> > >
> > > INSERT INTO ...;
> > > <dtml-var sql_delimiter>
> > >
> > > Crashes the sql on encountering the sql_delimiter.
> > >
> > > Does anyone know of any workaround outside of using separate ZSQL
> > > methods for each statement? I know... convert it to Python.  
> > No, just dont use 2 delimiter.
> > You have used ; _and_ sql_delimiter which would render to ;
> > too. I'm also not certain if the syntax was correct.
> > It should be something like sql-delimiter
> > Which renders ; too :-)
> 
> Your diagnosis is correct (I missed the semicolons first time around).
> However, <dtml-var sql_delimiter> does NOT render as a semicolon. It
> is, in fact a zero byte (\0). The ZSQL Method machinery uses that as a
> split character since it is (AFAIK) impossible to put in the query as
> a literal value ('\0' for example would be interpreted as backslash
> zero). Since it is a split character, you don't want one at the end,
> either. Also, while it's not an issue here, it's worth pointing out
> that you can only have one SELECT statement in a ZSQL Method.
> 
> So to sum up, what he needs is:
> 
> INSERT INTO ...
> <dtml-var sql_delimiter>
> INSERT INTO ...

Ah yes, while 2 selects indeed are possible (just checked)
I guess it depends a bit on the database. But you only
get the result of the last SELECT of course.

Regards
Tino



More information about the Zope mailing list