無論使用python還是sqlite,我都會收到此錯誤。在SQLite中讀取(從另一個表中)時插入行
File "addbooks.py", line 77, in saveBook
conn.commit()
sqlite3.OperationalError: cannot commit transaction - SQL statements in progress
的代碼看起來是這樣的:
conn = sqlite3.connect(fname)
cread = conn.cursor()
cread.execute('''select book_text from table''')
while True:
row = cread.fetchone()
if row is None:
break
....
for entry in getEntries(doc):
saveBook(entry, conn)
不能做一個使用fetchall(),因爲表和列的尺寸是大的,而內存不足。
沒有訴諸骯髒的技巧可以做什麼(如獲取內存中的rowid,這可能適合,然後逐一選擇行)?
是的,這有點棘手......它可能工作,雖然:-) – Samuel 2010-05-16 19:42:42