Re: [pysqlite] [3.6.3-r1] Row not updated?
Fred <[email protected]> Thu, 20 Nov 2008 23:30:18 +0100
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Roger Binns > Your code is using pysqlite but
that is a pointer to the APSW documentation! One
big difference between pysqlite and APSW is how they handle transactions.
Thanks Roger, but I went back to APSW since I was
getting errors with PySQLite as well.
So... what could possibly explain why this UPDATE
isn't actually commited after I exit the program
and re-open the database with the CLI client? I
don't know what else to try. Could it be that
APSW doesn't like sending an UPDATE followed by a bunch of BEGIN/INSERT/COMMIT?
========
#Why is this UPDATE gone after closing app and using sqlite3.exe?
sql = "UPDATE ape SET nombre=%s WHERE code='%s'" % (m.group(1),ape)
print sql
cursor.execute(sql)
#time.sleep(2)
#Displayed OK though
sql = "SELECT nombre FROM ape WHERE code='%s'" % ape
print sql
row=cursor.execute(sql)
for item in row:
print "Nombre=%s" % item[0]
#This series of INSERT do stay in DB
entreprise = re.compile('"\d+","\d+","(\d+)"')
matches = entreprise.finditer(response)
cursor.execute("BEGIN")
for match in matches:
lastsiren = match.group(1)
print "Found %s " % lastsiren
#On garde dernier SIREN en mémoire pour vérifier si page suivante
sql = 'INSERT INTO boites (code,siren) VALUES ("%s","%s")' % (ape,lastsiren)
cursor.execute(sql)
cursor.execute("COMMIT")
========
Thank you.