Re: [Zope] how to check if the ResultSet is null?

2000-07-14 Thread Robert Wohlfahrt

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 
  (tr
 td width="40%" align="right"Email Addressnbsp; /td
 td width="60%"input type="text" name="usr_email" size="20"/td
   /tr)
   
 This form takes an action in which I have following lines:
 dtml-if search_membership
 pYour email address has been used. /p
 dtml-else
 dtml-call personinfo_insert
 h2Welcome dtml-var name="usr_fname"! You became a new user./h2 
 /dtml-if

Does it work, if you use the dtml-indtml-else/dtml-in construct
as follows:
dtml-in search_membership size=1
pYour email address has been used. /p
dtml-else
dtml-call personinfo_insert
h2Welcome dtml-var name="usr_fname"! You became a new
user./h2 
/dtml-in

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?

2000-07-13 Thread Peter Marriott



You 
could always do something like this first:
"select Count(usr_email)  from info(table name) where 
usr_email = dtml-sqlvar usr_email type=string" 
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 = dtml-sqlvar 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!
  
  Sa


Re: [Zope] how to check if the ResultSet is null?

2000-07-13 Thread Chris Withers

You could always do something like this first:
"select Count(usr_email) from info(table name) where usr_email =
dtml-sqlvar usr_email type=string" 
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 = dtml-sqlvar usr_email type=string"

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?

2000-07-13 Thread Robert Wohlfahrt

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 = dtml-sqlvar 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

let's say, you called your ZSQL-method "getThisAddress"

then you can do something like this:

dtml-if getThisAddress
You are already in the database
/dtml-if

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?

2000-07-13 Thread Christopher J. Kucera

 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 = dtml-sqlvar
 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:

dtml-in MyMethod
  You've got some data
dtml-else
  Nothing returned from the SQL
/dtml-in

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?

2000-07-13 Thread slin

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 
 (tr
td width="40%" align="right"Email Addressnbsp; /td
td width="60%"input type="text" name="usr_email" size="20"/td
  /tr)
  
This form takes an action in which I have following lines:
dtml-if search_membership
pYour email address has been used. /p
dtml-else
dtml-call personinfo_insert
h2Welcome dtml-var name="usr_fname"! You became a new user./h2 
/dtml-if

where "search_membership" is an ZSQL method (select usr_email
from personinfo
where usr_email = dtml-var name="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 dtml-call personinfo_insert, 
everything is fine. However, when I added the dtml-if 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 = dtml-sqlvar 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
 
 let's say, you called your ZSQL-method "getThisAddress"
 
 then you can do something like this:
 
 dtml-if getThisAddress
   You are already in the database
 /dtml-if
 
 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 )




[Zope] how to check if the ResultSet is null?

2000-07-12 Thread Sa




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 = dtml-sqlvar 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!

Sa