fix chunk in sync
This commit is contained in:
parent
c97a096e8a
commit
93d37d6ab6
@ -239,32 +239,26 @@ class Syncer(object):
|
|||||||
self.tablesLeft = ["revlog", "cards", "notes"]
|
self.tablesLeft = ["revlog", "cards", "notes"]
|
||||||
self.cursor = None
|
self.cursor = None
|
||||||
|
|
||||||
def cursorForTable(self, table):
|
def queryTable(self, table):
|
||||||
lim = self.usnLim()
|
lim = self.usnLim()
|
||||||
with open("/dev/stdout", "w") as f:
|
|
||||||
f.write(str(type(self.col.db)))
|
|
||||||
x = self.col.db.execute
|
|
||||||
d = (self.maxUsn, lim)
|
|
||||||
if table == "revlog":
|
if table == "revlog":
|
||||||
return x("""
|
return self.col.db.execute("""
|
||||||
select id, cid, %d, ease, ivl, lastIvl, factor, time, type
|
select id, cid, ?, ease, ivl, lastIvl, factor, time, type
|
||||||
from revlog where %s""" % d)
|
from revlog where ?""", self.maxUsn, lim)
|
||||||
elif table == "cards":
|
elif table == "cards":
|
||||||
return x("""
|
return self.col.db.execute("""
|
||||||
select id, nid, did, ord, mod, %d, type, queue, due, ivl, factor, reps,
|
select id, nid, did, ord, mod, ?, type, queue, due, ivl, factor, reps,
|
||||||
lapses, left, odue, odid, flags, data from cards where %s""" % d)
|
lapses, left, odue, odid, flags, data from cards where ?""", self.maxUsn, lim)
|
||||||
else:
|
else:
|
||||||
return x("""
|
return self.col.db.execute("""
|
||||||
select id, guid, mid, mod, %d, tags, flds, '', '', flags, data
|
select id, guid, mid, mod, ?, tags, flds, '', '', flags, data
|
||||||
from notes where %s""" % d)
|
from notes where ?""", self.maxUsn, lim)
|
||||||
|
|
||||||
def chunk(self):
|
def chunk(self):
|
||||||
buf = dict(done=False)
|
buf = dict(done=False)
|
||||||
while self.tablesLeft:
|
while self.tablesLeft:
|
||||||
curTable = self.tablesLeft.pop()
|
curTable = self.tablesLeft.pop()
|
||||||
if not self.cursor:
|
buf[curTable] = self.queryTable(curTable)
|
||||||
self.cursor = self.cursorForTable(curTable)
|
|
||||||
buf[curTable] = self.cursor
|
|
||||||
if not self.tablesLeft:
|
if not self.tablesLeft:
|
||||||
buf['done'] = True
|
buf['done'] = True
|
||||||
return buf
|
return buf
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user