<div><font face="sans-serif" size="2">hi</font> <br><font face="sans-serif" size="2">i am using the Sybase connecttion object "execute(sql)" to call an SQL statement to my Sybase ASE</font> <br><br><font face="sans-serif" size="2">
here is the statement that i want to execute. basically to change a user password and update a table</font><br><br><font face="sans-serif" size="2">SQL= '''</font> <br><font face="sans-serif" size="2"> declare @res int
</font> <br><font face="sans-serif" size="2"> exec @res = sp_password 'sapass' ,'userpass', 'user'</font> <br><font face="sans-serif" size="2"> if @res = 0</font> <br><font face="sans-serif" size="2">
begin</font> <br><font face="sans-serif" size="2"> update passwdtable set pswd = 'userpass' user_name = 'user'</font> <br><font face="sans-serif" size="2"> select convert(int,1)
</font> --to return a int<br><font face="sans-serif" size="2"> end</font> <br><font face="sans-serif" size="2"> else</font> <br><font face="sans-serif" size="2"> begin</font>
<br><font face="sans-serif" size="2"> select convert(int,-1)</font> <br><font face="sans-serif" size="2"> end</font> <br><font face="sans-serif" size="2"> '''<br></font><br>
<font face="sans-serif" size="2">In the sybase manual, it says under the "Connections object" </font><br><font face="sans-serif" size="2">execute(sql)</font> <br><font face="sans-serif" size="2">......</font></div>
<div><font face="sans-serif" size="2">The return value</font> <font face="sans-serif" size="2">is a list of logical results. Each logical result is a list of row tuples.</font> <br>......<br><br><font face="sans-serif" size="2">
db = connect (....., auto_commit=1) </font><br><font face="sans-serif" size="2">def exec_stmt(SQL):</font> <br><font face="sans-serif" size="2"> try:</font> <br><font face="sans-serif" size="2"> a,b =
db.execute(SQL)</font> <br><font face="sans-serif" size="2"> db.commit()</font> <br><font face="sans-serif" size="2"> db.close()</font> <br><font face="sans-serif" size="2"> return a,b
</font> <br><font face="sans-serif" size="2"> except Sybase.DatabaseError:</font> <br><font face="sans-serif" size="2"> return -1</font> <br> </div>
<div>c,d= exec_stmt(SQL)</div>
<div><br><font face="sans-serif" size="2">when the result is returned, it shows a list of tuples ([(0,)], [(1,)])</font> . the password is changed and the update is successful by the way.<br><font face="sans-serif" size="2">
may i know how to interpret this results of tuples?</font> <br><font face="sans-serif" size="2">thanks</font> <br><br><br><br><br><font face="sans-serif" size="2"><br>-------------------------------------------------------------------------------------------------------------------------------------
<br><br> </font></div>
<table>
<tbody>
<tr>
<td bgcolor="#ffffff"><font color="#000000">_______________________<br>Privileged/Confidential information may be contained in this message.<br>If you are not the intended recipient, please notify the sender immediately.
<br>Check out our website at <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.mpa.gov.sg/" target="_blank">http://www.mpa.gov.sg</a><br></font></td></tr></tbody></table>