On Tuesday 21 August 2007 14:01, Ed Leafe wrote:
>
> OK, I've looked into this, and have fixed a couple of small things,
> but one big fact remains: that *any* failed execute(), even one
> wrapped in a try/except, will generate the dbActivityLog output for
> "FAILED SQL", since that appears as the first line of the except
> block. It re-raises the exception, where the try/except block in
> dbSQLite.commitTransaction() catches it and handles it properly.
I am confused as to the real cause of the error. In my debugging session I
found the issue to be in dPref.py with the
line "self._cursor.commitTransaction()"
>From dPref:
sql = "update daboprefs set ctype = ?, cvalue = ? where ckey = ? "
prm = (typ, val, key)
crs.execute(sql, prm)
# Use the dbapi-level 'rowcount' attribute to get the number
# of affected rows.
if not crs.rowcount:
sql = "insert into daboprefs (ckey, ctype, cvalue) values (?, ?, ?)"
prm = (key, typ, val)
crs.execute(sql, prm)
self._cursor.commitTransaction()
As I read the code "crs.execute(sql, prm)" updates the db (and it in fact it
does update the data). While doing so a transaction is started. I assume
that is true from Ed's prior statements on SQLite not needing a "begin". But
when the "self._cursor.commitTransaction()" fires - I get an error. The
error is there is no transaction started (as I reported in the earlier
email).
>
> My question to you is whether this is a problem for you. It is
> working exactly as expected, but if having those "FAILED SQL"
> messages in your logs looks wrong, I could remove the logging, but
> then you wouldn't have a log message when a query actually failed.
Is there a way to turn off the db logging only for the Pref DB?
>
> There is no way to test ahead of time in SQLite as to whether a
> transaction exists or not, so the only way to deal with this is to
> wrap the call to "COMMIT" in a try/except block, as we are doing.
>
> -- Ed Leafe
> -- http://leafe.com
> -- http://dabodev.com
--
John Fabiani
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]