[Zope] Re: [Zope-DB] Newbie - parameterized query...

John Coleman jcoleman at sbc.edu
Fri Dec 12 10:17:01 EST 2003


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 at 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.
> 




More information about the Zope mailing list