diff options
author | Gerhard Häring <gh@ghaering.de> | 2008-03-29 00:45:29 +0000 |
---|---|---|
committer | Gerhard Häring <gh@ghaering.de> | 2008-03-29 00:45:29 +0000 |
commit | e7ea7451a84636655927da4b9731d2eb37d1cf34 (patch) | |
tree | 7862ebdca8d04d799ddeacf4cf74e2a130e376b4 /Modules/_sqlite/util.c | |
parent | b1b9382d91e4b2e863225179cde4a61f0300a233 (diff) | |
download | cpython-git-e7ea7451a84636655927da4b9731d2eb37d1cf34.tar.gz |
Bring sqlite3 module up-to-date with what's now in 2.6. Almost. I intentionally
left out the stuff about creating a connection object from a APSW connection.
Diffstat (limited to 'Modules/_sqlite/util.c')
-rw-r--r-- | Modules/_sqlite/util.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/_sqlite/util.c b/Modules/_sqlite/util.c index 5e78d58846..e06c299564 100644 --- a/Modules/_sqlite/util.c +++ b/Modules/_sqlite/util.c @@ -1,6 +1,6 @@ /* util.c - various utility functions * - * Copyright (C) 2005-2006 Gerhard Häring <gh@ghaering.de> + * Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de> * * This file is part of pysqlite. * @@ -45,10 +45,15 @@ int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, pysqlite_Connection* * Checks the SQLite error code and sets the appropriate DB-API exception. * Returns the error code (0 means no error occurred). */ -int _pysqlite_seterror(sqlite3* db) +int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st) { int errorcode; + /* SQLite often doesn't report anything useful, unless you reset the statement first */ + if (st != NULL) { + (void)sqlite3_reset(st); + } + errorcode = sqlite3_errcode(db); switch (errorcode) |