Hi To check if a zsql method has returned a null record set , I use the following method in a python script px = [] #Declaring an array pset = context.oms.Proj.Task.db.zsqlr_task(id = id1) #Calling the Zsql Method paassing a varible id for c in pset: px = px + [[c[0]]] #Inserting the value of the first field into the array if (px == []): print "No Record" #If the record set has no values It returns an empty array(Here i am just printing a message) else: print px #Else the first field value is printed out This is how i do the check .Is there a better way to check if the record set returned is Null or not? This is a way I have been able to figure out. Best Regards John Kunchandy
alienoid wrote:
Hello zope users,
Case:
I call zsql method from python script, how can I get information about successful or unsuccessful return of zsql method within python script?
Your help is very appreciated
What is the meaning of succesful return ? You would get the result in a dictionary if the query is executed without any errors. This may be empty if the result is empty. If there are any issues with the execution of the query you should see an error message giving you some information on the type of error.
HTH Chetan
_______________________________________________
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.381 / Virus Database: 214 - Release Date: 8/2/2002