newbie question: parameter passing for ZSQL Object
Hi. With some values that I got from a formular, I wan't to do some calculation stuff, and insert the calculated values into a database. My Z SQL method'insertItem' looks like Arguments: param1, param2, param3, param4 INSERT INTO plan (field1, field2, field3, field4) VALUES (<dtml-var param1>, <dtml-var param2>, <dtml-var param3>, <dtml-var param4>) (parameters should be integer values) Can anybody tell me how I can call this method and pass parameters from my DTML method? With <dtml-call insertItem>, Zope gives me following error message: Zope has encountered an error while publishing this resource. Error Type: Bad Request Error Value: ['param1', 'param2', 'param3', 'param4'] I was checking then "ZSQL Methods User's Guide" but, they don't give an example :-( Please help. Any idea? Thanks, Marc.
In article <4.3.2.20000526083542.00af2160@mail.isp.lu>, zope <zope@isp.lu> writes
My Z SQL method'insertItem' looks like
Arguments: param1, param2, param3, param4
INSERT INTO plan (field1, field2, field3, field4) VALUES (<dtml-var param1>, <dtml-var param2>, <dtml-var param3>, <dtml-var param4>)
Insert into plan ( field1, field2, field3 field4 ) values ( <dtml-sqlvar param1 type=int>, <dtml-sqlvar param2 type=int>, <dtml-sqlvar param3 type=int>, <dtml-sqlvar param4 type=int> ) <dtml-call "insertItem(param1=param1, param2=param2, param3=param3, param4 )"> -- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.co.nz/index.php Powered by Interbase and Zope
1. Check that your parameters ara on scope 2. try the following: <dtml-call "InsertItem(param1=param1,param2=param2,param3=param3,param4=param4)"> ...And in the ZSQL method define your dtml-vars as <dtml-sqlvar param1 type=int> (etc) zope wrote:
Hi.
With some values that I got from a formular, I wan't to do some calculation stuff, and insert the calculated values into a database.
My Z SQL method'insertItem' looks like
Arguments: param1, param2, param3, param4
INSERT INTO plan (field1, field2, field3, field4) VALUES (<dtml-var param1>, <dtml-var param2>, <dtml-var param3>, <dtml-var param4>)
(parameters should be integer values)
Can anybody tell me how I can call this method and pass parameters from my DTML method?
With <dtml-call insertItem>, Zope gives me following error message:
Zope has encountered an error while publishing this resource. Error Type: Bad Request Error Value: ['param1', 'param2', 'param3', 'param4']
I was checking then "ZSQL Methods User's Guide" but, they don't give an example :-(
Please help. Any idea?
Thanks, Marc.
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
With <dtml-call insertItem>, Zope gives me following error message:
If the parameters are from another SQL statement, then the SQL method will not find them, since not the entire namespace is sent. Try: <dtml-call "insertItem(param1=pvalue1, param2=pvalue2, param3=pvalue3, param4=pvalue4)"> pvalueX can be also a variable. If your variables are called paramX, then the following will work: <dtml-call "insertItem(param1=param1, param2=param2, param3=param3, param4=param4)"> That is typical Python syntax. So in case you want to know why and how that works, read a little in the Python documentation (which is btw excellent.) Regards, Stephan -- Stephan Richter CBU - Physics and Chemistry Web2k - Web Design/Development & Technical Project Management
participants (4)
-
Graham Chiu -
Grakka -
Stephan Richter -
zope