我正在尝试在 sqlite 调用中做一些数学运算。我有两列要添加它们的值,然后检查它们是否小于我输入的值。
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
据我所知,它没有做这个操作。它仍然返回一行,但不是基于我提供的逻辑。