[Zope] Calling SQL methods
Martijn Pieters
mj@antraciet.nl
Wed, 05 May 1999 15:04:48 +0200
At 14:21 05/05/99 , Alexander Staubo wrote:
>> SNIP <<
> How do I execute an SQL Method from a DTML Method?
>
> Say I have an SQL Method with the SQL command:
>
> insert into blah (title)
> values (<!--#sqlvar title type=string-->)
>
>> SNIP <<
>
> By the way, my real-world app uses the syntax
>
> <!--#call "Data.InsertNew"-->
>
> instead of the above, as I have a separate folder Data for the database
> objects.
Having put the SQL Method in quotes, it becomes an expression.
Putting an identifier in a call tag without quotes (like <!--#call
MySQLMeth-->) calls that method, however, putting it in quotes, without
adding parentheses, results in the statement returning the Python object,
instead of calling the method. As you are using a call tag, you don't see
what went wrong.
Change your code to:
<!--#call "Data.InsertNew()"-->
And it will work.
--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------