E
eight02645999
hi
i defined a func
db = Sybase.connect(DSN) ....
....
def x_dml(SQL,conn):
''' Connects to database specified, exec the SQL and returns
value'''
try:
c = conn.cursor()
try:
c.execute(SQL)
res = c.rowcount
conn.commit()
return res
except :
return -1
except:
return -2
stmt = """
update table1 set col = '%s' where col = '%s'
update table2 set col = '%s' where col = '%s'
""" % ( blah, blah ,blah,blah)
try:
r = x_dml(stmt,db)
if r > 0:
print r
except:
print "some error"
Whenever i execute x_dml , it raise the exeception, even though my r is
value of 1 and i checked the database tables, they are updated with
what i want.
somehow the condition r>0 did not work..any advice ?
thanks
i defined a func
db = Sybase.connect(DSN) ....
....
def x_dml(SQL,conn):
''' Connects to database specified, exec the SQL and returns
value'''
try:
c = conn.cursor()
try:
c.execute(SQL)
res = c.rowcount
conn.commit()
return res
except :
return -1
except:
return -2
stmt = """
update table1 set col = '%s' where col = '%s'
update table2 set col = '%s' where col = '%s'
""" % ( blah, blah ,blah,blah)
try:
r = x_dml(stmt,db)
if r > 0:
print r
except:
print "some error"
Whenever i execute x_dml , it raise the exeception, even though my r is
value of 1 and i checked the database tables, they are updated with
what i want.
somehow the condition r>0 did not work..any advice ?
thanks