Reputation: 95
I am trying to return a numeric value from this statement:
c = db.execute("""SELECT *, rowid FROM members WHERE barcode = '%s' AND debit > 0 LIMIT 50""" % (s,))
But I get this as the returned value:
sqlite3.Cursor object at 0xb6cb2720
What should I do with this cursor object to get the results?
Upvotes: 3
Views: 19267
Reputation: 95
One of my problems was, I was using the wrong SQL query to get the data I wanted. See:
c = db.execute("""SELECT "debit" FROM "members" WHERE "barcode" = '%s' LIMIT 1""" % (s,))
I would then get the response:
(0,)
Which was what I needed. Now to actually work out how to compare it - I need to say "if c is not equal to (0,) then print 'cross' else print 'tick'..."
Upvotes: 0
Reputation: 1
I just convert to list of tuples
sql="SELECT *, rowid FROM members WHERE barcode = '%s' AND debit > 0 LIMIT 50" % (s,)
c = list(db.execute(sql)
Upvotes: 0