Newbie - parameterized query...
Hello , My problem is that: I have ZPT pages, and scripts. I want to check some infos with SQL query. This an example: script: ------- ss=context.REQUEST.SESSION r=0 uusr=usr.lower() result=context.LoginScripts.dbcheckUsrPwd(uusr,pwd) if len(result)>0: r=1 ss['userid']=row[0] ss["username"]=usr ss["full username"]=row[1] return(r) zsql: ----- params: usr,pwd select * from inst_prguser where webusr=<dtml-sqlvar usr type="string"> and webpwd=<dtml-sqlvar pwd type="string"> The result is: "Missing input variable, usr". I think this is wrong in zsql - it have wait for dtml-var. But how to I do it in good way to the zsql get good parameters ? Thanx. -- Best regards, fowlertrainer mailto:fowlertrainer@anonym.hu
Try to pass the arguments as keyword parameters. -aj P.S. and stop cross-postings over several lists --On Donnerstag, 4. Dezember 2003 13:33 Uhr +0100 fowlertrainer@anonym.hu wrote:
Hello ,
My problem is that:
I have ZPT pages, and scripts. I want to check some infos with SQL query.
This an example:
script: ------- ss=context.REQUEST.SESSION r=0 uusr=usr.lower() result=context.LoginScripts.dbcheckUsrPwd(uusr,pwd) if len(result)>0: r=1 ss['userid']=row[0] ss["username"]=usr ss["full username"]=row[1] return(r)
zsql: ----- params: usr,pwd
select * from inst_prguser where webusr=<dtml-sqlvar usr type="string"> and webpwd=<dtml-sqlvar pwd type="string">
The result is: "Missing input variable, usr".
I think this is wrong in zsql - it have wait for dtml-var. But how to I do it in good way to the zsql get good parameters ?
Thanx.
fowlertrainer@anonym.hu wrote:
------- ss=context.REQUEST.SESSION r=0 uusr=usr.lower() result=context.LoginScripts.dbcheckUsrPwd(uusr,pwd) if len(result)>0: r=1 ss['userid']=row[0] ss["username"]=usr ss["full username"]=row[1] return(r)
zsql: ----- params: usr,pwd
select * from inst_prguser where webusr=<dtml-sqlvar usr type="string"> and webpwd=<dtml-sqlvar pwd type="string">
The result is: "Missing input variable, usr".
You need to specify the arguments as keywords when calling a ZSql method. Try this: result = context.LoginScripts.dbcheckUsrPwd(usr=uusr, pwd=pwd) Hope that helps, Kevin
Change result=context.LoginScripts.dbcheckUsrPwd(uusr,pwd) to result=context.LoginScripts.dbcheckUsrPwd(usr=uusr,pwd=pwd) It looks weird but that's how it's done. John fowlertrainer@anonym.hu wrote:
Hello ,
My problem is that:
I have ZPT pages, and scripts. I want to check some infos with SQL query.
This an example:
script: ------- ss=context.REQUEST.SESSION r=0 uusr=usr.lower() result=context.LoginScripts.dbcheckUsrPwd(uusr,pwd) if len(result)>0: r=1 ss['userid']=row[0] ss["username"]=usr ss["full username"]=row[1] return(r)
zsql: ----- params: usr,pwd
select * from inst_prguser where webusr=<dtml-sqlvar usr type="string"> and webpwd=<dtml-sqlvar pwd type="string">
The result is: "Missing input variable, usr".
I think this is wrong in zsql - it have wait for dtml-var. But how to I do it in good way to the zsql get good parameters ?
Thanx.
participants (4)
-
Andreas Jung -
fowlertrainerļ¼ anonym.hu -
John Coleman -
Kevin Carlson