Graham Dumpleton
grahamd at dscpl.com.au
Thu Jan 12 16:48:29 EST 2006
You are persistent, I give you that. Some questions you should answer yourself and which may help you to work out what you are doing wrong. First, what have you actually done to debug the problem? Have you generated any debug output from your handler back to the web page to confirm what the values being compared are and what the types of the values are? Since your script isn't particularly dependent on mod_python, have you extracted it into a standalone command line script where it will be easier to debug? Ie., if run as a command line script, you can still use 'print' to output debugging. If run under mod_python you need to either log debug to the Apache log file and look in the error log file for the messages, or write the debug back to the web browser so you can see it. For example, you might use: from mod_python import apache for PID in cursor.fetchall(): apache.log_error("pid=%s"%`pid`) apache.log_error("type pid=%s"%`type(pid)`) apache.log_error("PID=%s"%`PID`) apache.log_error("type PID=%s"%`type(PID)`) if pid==PID: self.writeln("Equal") else: self.writeln("Not Equal") or: req.content_type = 'text/plain' for PID in cursor.fetchall(): req.write("pid=%s\n"%`pid`) req.write("type pid=%s\n"%`type(pid)`) req.write("PID=%s\n"%`PID`) req.write("type PID=%s\n"%`type(PID)`) if pid==PID: self.writeln("Equal") else: self.writeln("Not Equal") If you are going to keep posting these questions to mod_python list instead of a list more specific to the Python DB API being used, at least read: http://www.catb.org/~esr/faqs/smart-questions.html Graham python eager wrote .. > Hi , > here i am comparing both the values of form value and table value. > But it will not work . The result will be print "not equal". Table values > are retrieved fine. Here what mistake i did. No compilation error and run > time error. Please solve this problem. > > Code Snippet : > > req = self.request() > pid = int(req.field('pid')) > self.writeln(pid) > > dbconnection = cx_Oracle.connect("myusername", "mypassword", > "mydatabase") > cursor = dbconnection.cursor() > cursor.arraysize = 50 > cursor.execute("SELECT PID FROM PERSONALDETAILS order by pid") > for PID in cursor.fetchall(): > # Comparing here both formvalue and table value ( both are > numeric) > if pid==PID: > self.writeln("Equal") > else: > self.writeln("Not Equal") > > Thank you > Python_Eager > > > > --------------------------------- > Yahoo! Photos Showcase holiday pictures in hardcover > Photo Books. You design it and well bind it!
|