[Zope] Calling SQL methods

Alexander Staubo alex@mop.no
Wed, 5 May 1999 14:21:19 +0200


Please forgive this blatantly newbie question -- but to my defense, I
couldn't find any real information on this topic in the guides, FAQ, or
anywhere else.

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

Now let's say I have a form, thusly:

	<form action="PostNew" method="post">
	<input type="text" name="title" value="">
	<input type="submit">
	</form>

Unfortunately, if PostNew the name of the SQL Method, it doesn't work.
SQL Methods don't support this. Paul Everitt graciously suggested that I
create a sort of proxy document:

	<!--#var standard_html_header-->
	<!--#call Post_The_Record-->
	<!--#var standard_html_footer-->

Assuming that Post_The_Record is my SQL Method, it ought to pick up the
REQUEST info and do the right thing.

Unfortunately that doesn't happen. It seems that the "call" command
doesn't do anything. I don't get any errors, but the SQL Method isn't
executed, either.

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.

I'm mildly surprised that there is nothing in the tutorial, references,
or guides that show how to do dynamic updates, ad-hoc queries, and so
on.

Alexander Staubo
http://www.mop.no/~alex/
mailto:redhand@mop.no