[Zope] Having problems with SQL methods

Thomas Weiner t_wein@gmx.de
Sat, 18 Sep 1999 13:55:49 +0200


Peter Whysall schrieb:
> 
> I have an SQL method:
> 
> ID: insert_call_data.sql
> TITLE: Insert Call Data Query
> ARGUMENTS: user_id, call_type_id, call_desc, call_date, costcode_id

Use a simple space - without a comma - to separate the arguments of the
ZSQL Method.

hth,
thomas
 
> Query Template:
> 
> INSERT INTO calls
> (user_id,
>  call_type_id,
>  call_desc,
>  call_date,
>  costcode_id)
> VALUES
> (
> <dtml-sqlvar user_id type=int>,
> <dtml-sqlvar call_type_id type=int>,
> <dtml-sqlvar call_desc type=string>,
> <dtml-sqlvar call_date type=nb>,
> <dtml-sqlvar costcode_id type=int>
> );
> 
> When I do a change and test, I get the form to fill out, and I fill out
> the arguments.
> 
> When I submit the query, I get this:
> 
> Error, Missing Input: Missing input variable, user_id
> 
> SQL used:
> 
> Could not render the query template!
> 
> And this traceback:
> 
> Traceback (innermost last):
>   File /opt/Zope/lib/python/ZPublisher/Publish.py, line 214, in
> publish_module
>   File /opt/Zope/lib/python/ZPublisher/Publish.py, line 179, in publish
>   File /opt/Zope/lib/python/Zope/__init__.py, line 201, in
> zpublisher_exception_hook
>     (Object: insert_call_data.sql)
>   File /opt/Zope/lib/python/ZPublisher/Publish.py, line 165, in publish
>   File /opt/Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
>     (Object: manage_test)
>   File /opt/Zope/lib/python/ZPublisher/Publish.py, line 102, in
> call_object
>     (Object: manage_test)
>   File /opt/Zope/lib/python/Shared/DC/ZRDB/DA.py, line 316, in manage_test
>     (Object: insert_call_data.sql)
>   File /opt/Zope/lib/python/Shared/DC/ZRDB/DA.py, line 295, in manage_test
>     (Object: insert_call_data.sql)
>   File /opt/Zope/lib/python/Shared/DC/ZRDB/DA.py, line 395, in __call__
>     (Object: insert_call_data.sql)
>   File /opt/Zope/lib/python/DocumentTemplate/DT_String.py, line 502, in
> __call__
>     (Object: <string>)
>   File /opt/Zope/lib/python/Shared/DC/ZRDB/sqlvar.py, line 168, in render
>     (Object: user_id)
> Missing Input: (see above)
> 
> What am I doing wrong?
> Is this the best way of inserting data into tables?
> Is there a document I should read before posting such newbie questions? (I
> *have* read the Z SQL Methods User's Guide, but that seems to have nothing
> on inserting data)
> 
> Regards
> 
> Peter.
> --
> Peter Whysall
> Systems Engineer
> Serco Technology
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )