Merged changes from standalone version 2.3.3. This should probably all be

merged into the 2.5 maintenance branch:

- self->statement was not checked while fetching data, which could
  lead to crashes if you used the pysqlite API in unusual ways.
  Closing the cursor and continuing to fetch data was enough.

- Converters are stored in a converters dictionary. The converter name
  is uppercased first. The old upper-casing algorithm was wrong and
  was replaced by a simple call to the Python string's upper() method
  instead.

-Applied patch by Glyph Lefkowitz that fixes the problem with
 subsequent SQLITE_SCHEMA errors.

- Improvement to the row type: rows can now be iterated over and have a keys()
  method. This improves compatibility with both tuple and dict a lot.

- A bugfix for the subsecond resolution in timestamps.

- Corrected the way the flags PARSE_DECLTYPES and PARSE_COLNAMES are
  checked for. Now they work as documented.

- gcc on Linux sucks. It exports all symbols by default in shared
  libraries, so if symbols are not unique it can lead to problems with
  symbol lookup.  pysqlite used to crash under Apache when mod_cache
  was enabled because both modules had the symbol cache_init. I fixed
  this by applying the prefix pysqlite_ almost everywhere. Sigh.
This commit is contained in:
Gerhard Häring 2007-01-14 01:43:50 +00:00
parent b1a8ef6297
commit 0741a60ca7
22 changed files with 572 additions and 488 deletions

View file

@ -24,8 +24,7 @@
#include "module.h"
#include "connection.h"
int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, Connection* connection
)
int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, pysqlite_Connection* connection)
{
int rc;
@ -40,7 +39,7 @@ int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, Connection* connectio
* Checks the SQLite error code and sets the appropriate DB-API exception.
* Returns the error code (0 means no error occurred).
*/
int _seterror(sqlite3* db)
int _pysqlite_seterror(sqlite3* db)
{
int errorcode;
@ -53,7 +52,7 @@ int _seterror(sqlite3* db)
break;
case SQLITE_INTERNAL:
case SQLITE_NOTFOUND:
PyErr_SetString(InternalError, sqlite3_errmsg(db));
PyErr_SetString(pysqlite_InternalError, sqlite3_errmsg(db));
break;
case SQLITE_NOMEM:
(void)PyErr_NoMemory();
@ -71,23 +70,23 @@ int _seterror(sqlite3* db)
case SQLITE_PROTOCOL:
case SQLITE_EMPTY:
case SQLITE_SCHEMA:
PyErr_SetString(OperationalError, sqlite3_errmsg(db));
PyErr_SetString(pysqlite_OperationalError, sqlite3_errmsg(db));
break;
case SQLITE_CORRUPT:
PyErr_SetString(DatabaseError, sqlite3_errmsg(db));
PyErr_SetString(pysqlite_DatabaseError, sqlite3_errmsg(db));
break;
case SQLITE_TOOBIG:
PyErr_SetString(DataError, sqlite3_errmsg(db));
PyErr_SetString(pysqlite_DataError, sqlite3_errmsg(db));
break;
case SQLITE_CONSTRAINT:
case SQLITE_MISMATCH:
PyErr_SetString(IntegrityError, sqlite3_errmsg(db));
PyErr_SetString(pysqlite_IntegrityError, sqlite3_errmsg(db));
break;
case SQLITE_MISUSE:
PyErr_SetString(ProgrammingError, sqlite3_errmsg(db));
PyErr_SetString(pysqlite_ProgrammingError, sqlite3_errmsg(db));
break;
default:
PyErr_SetString(DatabaseError, sqlite3_errmsg(db));
PyErr_SetString(pysqlite_DatabaseError, sqlite3_errmsg(db));
break;
}