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. Harlow Pinson Indepth Learning Email: hpinson@indepthl.com Web: http://www.indepthl.com Voice: 505-994-2135 FAX: 208-475-7678
Am Montag, den 24.01.2005, 15:04 -0700 schrieb hpinson@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 :-)
On Tue, 25 Jan 2005 06:52:10 +0100, Tino Wildenhain <tino@wildenhain.de> wrote:
Am Montag, den 24.01.2005, 15:04 -0700 schrieb hpinson@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.
Am Dienstag, den 25.01.2005, 10:01 -0500 schrieb Andy Dustman:
On Tue, 25 Jan 2005 06:52:10 +0100, Tino Wildenhain <tino@wildenhain.de> wrote:
Am Montag, den 24.01.2005, 15:04 -0700 schrieb hpinson@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
participants (3)
-
Andy Dustman -
hpinson@indepthl.com -
Tino Wildenhain