Mercurial > cpython-lru_cache-weakref
diff Modules/_sqlite/util.c @ 46178:e06e08e8fdce
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.
| author | Gerhard Häring <gh@ghaering.de> |
|---|---|
| date | Sat, 29 Mar 2008 00:45:29 +0000 |
| parents | 71623878057b |
| children | 8f886acaa142 |
line wrap: on
line diff
--- a/Modules/_sqlite/util.c Sat Mar 29 00:41:18 2008 +0000 +++ b/Modules/_sqlite/util.c Sat Mar 29 00:45:29 2008 +0000 @@ -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 @@ * 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)
