[Zope] sql_delimiter broken?

Andy Dustman farcepest at gmail.com
Tue Jan 25 10:01:06 EST 2005


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 ...

with no semicolons in sight.
-- 
Computer interfaces should never be made of meat.

Using GMail? Setting Reply-to address to <> disables this annoying feature.


More information about the Zope mailing list