I am trying to do a little bit of math in in a sqlite call. I have two columns that I want to add their value then check to see if they are less than a value that I input.
c = self.db.cursor()
c.execute("BEGIN EXCLUSIVE TRANSACTION");
c.execute("SELECT ID as id,task FROM tube WHERE state=0 OR (state=1 & ts+ttr<? ) ORDER BY ID ASC LIMIT 1", (time.time(),))
task = c.fetchone()
print task
if task != None:
ts = time.time();
c.execute("UPDATE tube SET state=1,ts=? WHERE ID=?", (ts, task['id']))
task['ts'] = ts
else:
task = None
self.db.commit()
return task
From what I can tell its not doing this operation. It still returns a row but not based on the logic I am providing.
BottleorFlask? to try to understand what could be returned byc.fetchone()and then if it's possible to modify it on the fly by adding ts to it.def fetchone()? as I dont see yet a known ORM that provides this function