Re: [Zope] how to check if the ResultSet is null?
Hi, > Hi, I still got problems after I changed my code according to your > suggestion. Here is the detail describtion of my code: > In registration form, I have a table which contain a field usr_email > ( > Email Address > > ) > > This form takes an action in which I have following lines: > > Your email address has been used. > > > Welcome ! You became a new user. > Does it work, if you use the construct as follows: Your email address has been used. Welcome ! You became a new user. If not, are you sure you inserted usr_email into the "Arguments"-field of your sql-Method? Robert -- Robert Wohlfahrt ([EMAIL PROTECTED]) Tel: 0179 / 2980074 Fax: 0351 / 2880145 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to check if the ResultSet is null?
Hi, I still got problems after I changed my code according to your suggestion. Here is the detail describtion of my code: In registration form, I have a table which contain a field usr_email ( Email Address ) This form takes an action in which I have following lines: Your email address has been used. Welcome ! You became a new user. where "search_membership" is an ZSQL method (select usr_email from personinfo where usr_email = ) and "personinfo_insert" is a ZSQL method which insert the data to the table("personinfo") My idea is first checking if usr_email is in the table, if so, do not insert, otherwise insert. If I just use , everything is fine. However, when I added the as above, I got the following error: Zope has encountered an error while publishing this resource. Error Type: KeyError Error Value: usr_email Could you help me out? Thanks! Sa > Hi, > > > > > Hi, I stuck on a problem: I am creating a registration form. I need > > to check if the person info has already in database. I created a Z SQL > > method which I used "select usr_email from info(table name) where > > usr_email = " I want to call this > > method from my dtml method and see if it returns "null". But I'm not > > sure how to implement this. In Java, it has ResultSet which I can > > let's say, you called your ZSQL-method "getThisAddress" > > then you can do something like this: > > > You are already in the database > > > Robert > -- > Robert Wohlfahrt ([EMAIL PROTECTED]) > Tel: 0179 / 2980074 Fax: 0351 / 2880145 > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to check if the ResultSet is null?
> Sa wrote: > > Hi, I stuck on a problem: I am creating a registration form. I need to check > if the person info has already in database. I created a Z SQL method which I > used "select usr_email from info(table name) where usr_email = usr_email type=string>" I want to call this method from my dtml method and > see if it returns "null". But I'm not sure how to implement this. In Java, > it has ResultSet which I can check if it returns null. I'm not sure how to > accomplish this in Zope. I could not find relevant document. If you know > this, could you give me a hand? Thanks! If your ZSQL Method is named MyMethod: You've got some data Nothing returned from the SQL Hope that helps . . . -CJ ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to check if the ResultSet is null?
Hi, > > Hi, I stuck on a problem: I am creating a registration form. I need > to check if the person info has already in database. I created a Z SQL > method which I used "select usr_email from info(table name) where > usr_email = " I want to call this > method from my dtml method and see if it returns "null". But I'm not > sure how to implement this. In Java, it has ResultSet which I can let's say, you called your ZSQL-method "getThisAddress" then you can do something like this: You are already in the database Robert -- Robert Wohlfahrt ([EMAIL PROTECTED]) Tel: 0179 / 2980074 Fax: 0351 / 2880145 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to check if the ResultSet is null?
You could always do something like this first: "select Count(usr_email) from info(table name) where usr_email = " Then check the result will be either 1 or 0. That's asking for trouble 'cos Zope ain't gonna like an id such as 'Count(usr_email)', it's a great idea though :-) Here's how you might need to rephrase it to make Zope happy: "select Count(usr_email) as usremail from info(table name) where usr_email = " HTH, Chris ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] how to check if the ResultSet is null?
You could always do something like this first: "select Count(usr_email) from info(table name) where usr_email = " Then check the result will be either 1 or 0. Cheers Peter -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of SaSent: Thursday, 13 July 2000 6:04 AMTo: [EMAIL PROTECTED]Subject: [Zope] how to check if the ResultSet is null? Hi, I stuck on a problem: I am creating a registration form. I need to check if the person info has already in database. I created a Z SQL method which I used "select usr_email from info(table name) where usr_email = " I want to call this method from my dtml method and see if it returns "null". But I'm not sure how to implement this. In Java, it has ResultSet which I can check if it returns null. I'm not sure how to accomplish this in Zope. I could not find relevant document. If you know this, could you give me a hand? Thanks! Sa