[Tutor] Squlite3 problem

2007-03-13 Thread Jim Roush
I'm geting the following error message and I'm stumped

Traceback (most recent call last):
  File C:\markets\source\QuantScan\QuantScan4_3.py, line 1362, in module

db.close()

sqlite3.OperationalError: Unable to close due to unfinalised statements



Here 's the relevant code

db = sqlite.connect('c:/markets/db/market_2.db')
cur_stocks = db.cursor()
cur_quant = db.cursor()
cur_subind = db.cursor()
   
# update ROC table in db
print '\nupdate ROC table in db...\n'
cur = db.cursor()
cur.execute(delete from subind_ROC)
   
for row in range(0, num_of_subinds):
(subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2, si_ROC_20, 
si_ROC_20_1, \
si_ROC_20_2, si_ROC_30, si_ROC_30_1, si_ROC_30_2) = si_ROC[row]

cur.execute(INSERT INTO subind_ROC (subind, ROC_10, ROC_10_1, 
ROC_10_2, ROC_20, ROC_20_1, ROC_20_2, ROC_30, ROC_30_1, ROC_30_2) Values 
(?,?,?,?,?,?,?,?,?,?), (subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2, 
si_ROC_20, si_ROC_20_1, si_ROC_20_2, si_ROC_30, si_ROC_30_1, si_ROC_30_2))

cur.close()
db.commit()
db.close()

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Squlite3 problem

2007-03-13 Thread Jason Massey

I found a similar discussion on the pysqlite mailing list (
http://lists.initd.org/pipermail/pysqlite/2005-August/000127.html)

Try committing your changes and then closing your cursor.


db.commit()
cur.close()
db.close()

On 3/13/07, Jim Roush [EMAIL PROTECTED] wrote:


I'm geting the following error message and I'm stumped

Traceback (most recent call last):
  File C:\markets\source\QuantScan\QuantScan4_3.py, line 1362, in
module

db.close()

sqlite3.OperationalError: Unable to close due to unfinalised statements



Here 's the relevant code

db = sqlite.connect('c:/markets/db/market_2.db')
cur_stocks = db.cursor()
cur_quant = db.cursor()
cur_subind = db.cursor()

# update ROC table in db
print '\nupdate ROC table in db...\n'
cur = db.cursor()
cur.execute(delete from subind_ROC)

for row in range(0, num_of_subinds):
(subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2, si_ROC_20,
si_ROC_20_1, \
si_ROC_20_2, si_ROC_30, si_ROC_30_1, si_ROC_30_2) =
si_ROC[row]

cur.execute(INSERT INTO subind_ROC (subind, ROC_10, ROC_10_1,
ROC_10_2, ROC_20, ROC_20_1, ROC_20_2, ROC_30, ROC_30_1, ROC_30_2) Values
(?,?,?,?,?,?,?,?,?,?), (subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2,
si_ROC_20, si_ROC_20_1, si_ROC_20_2, si_ROC_30, si_ROC_30_1, si_ROC_30_2))

cur.close()
db.commit()
db.close()

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor