connect.execute() results
mike <[email protected]> Wed, 2 Nov 2005 17:06:18 +0800
| Newsgroups | gmane.comp.python.sybase |
|---|---|
| Message-ID | <[email protected]> |
hi i am using the Sybase connecttion object "execute(sql)" to call an SQL statement to my Sybase ASE here is the statement that i want to execute. basically to change a user password and update a table SQL= ''' declare @res int exec @res = sp_password 'sapass' ,'userpass', 'user' if @res = 0 begin update passwdtable set pswd = 'userpass' user_name = 'user' select convert(int,1) --to return a int end else begin select convert(int,-1) end ''' In the sybase manual, it says under the "Connections object" execute(sql) ...... The return value is a list of logical results. Each logical result is a list of row tuples. ...... db = connect (....., auto_commit=1) def exec_stmt(SQL): try: a,b = db.execute(SQL) db.commit() db.close() return a,b except Sybase.DatabaseError: return -1 c,d= exec_stmt(SQL) when the result is returned, it shows a list of tuples ([(0,)], [(1,)]) . the password is changed and the update is successful by the way. may i know how to interpret this results of tuples? thanks ------------------------------------------------------------------------------------------------------------------------------------- _______________________ Privileged/Confidential information may be contained in this message. If you are not the intended recipient, please notify the sender immediately. Check out our website at http://www.mpa.gov.sg _______________________________________________ Python-sybase mailing list [email protected] https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase