Re: [pysqlite] [3.6.3-r1] Row not updated?

Roger Binns <[email protected]> Fri, 21 Nov 2008 00:34:48 -0800
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fred wrote:
> 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?

This isn't the whole application so it isn't possible to tell
definitively.  From inspection, it should be fine.  Depending on file
names and virus scanners, it is possible that the file is being messed
with by external programs.  Try changing the file name to something like
"mydatabase".

> 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?

APSW doesn't care what the queries are and never parses them or does
anything else wacky.  They are passed as is to SQLite after UTF8 conversion.

> ========
> #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)

Make the program pause here and then run sqlite3.exe dump on the database.

As Dennis points out you are wide open to SQL injection attacks.  Your
exception handling is also not shown.  Sometimes people catch all
exceptions with the intent of debugging but accidentally end up
swallowing all exceptions.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkkmcqUACgkQmOOfHg372QSnEgCfZeXD0HPAYkpLVRK52Ao+hDy8
lr0AoLQC1hN4P8WbYJkb9gnolHtVXqA6
=yqpP
-----END PGP SIGNATURE-----