Metadata-Version: 1.1
Name: pysqlite3
-Version: 0.1.0
+Version: 0.1.1
Summary: DB-API 2.0 interface for Sqlite 3.x
Home-page: https://github.com/rigglemania/pysqlcipher3
Author: Charles Leifer
Metadata-Version: 1.1
Name: pysqlite3
-Version: 0.1.0
+Version: 0.1.1
Summary: DB-API 2.0 interface for Sqlite 3.x
Home-page: https://github.com/rigglemania/pysqlcipher3
Author: Charles Leifer
[egg_info]
tag_build =
tag_date = 0
-tag_svn_revision = 0
# If you need to change anything, it should be enough to change setup.cfg.
PACKAGE_NAME = 'pysqlite3'
-VERSION = '0.1.0'
+VERSION = '0.1.1'
# define sqlite sources
sources = [os.path.join('src', source)
{
static char *kwlist[] = {
"database", "timeout", "detect_types", "isolation_level",
- "check_same_thread", "factory", "cached_statements", "uri",
+ "check_same_thread", "factory", "cached_statements", "uri", "flags",
NULL
};
PyObject* factory = NULL;
int check_same_thread = 1;
int cached_statements = 100;
+ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
int uri = 0;
double timeout = 5.0;
int rc;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|diOiOip", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|diOiOipi", kwlist,
&database, &timeout, &detect_types,
&isolation_level, &check_same_thread,
- &factory, &cached_statements, &uri))
+ &factory, &cached_statements, &uri,
+ &flags))
{
return -1;
}
#ifdef SQLITE_OPEN_URI
Py_BEGIN_ALLOW_THREADS
rc = sqlite3_open_v2(database, &self->db,
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
- (uri ? SQLITE_OPEN_URI : 0), NULL);
+ flags | (uri ? SQLITE_OPEN_URI : 0), NULL);
#else
if (uri) {
PyErr_SetString(pysqlite_NotSupportedError, "URIs not supported");
return -1;
}
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_open(database, &self->db);
+ rc = sqlite3_open_v2(database, &self->db, flags, NULL);
#endif
Py_END_ALLOW_THREADS
sqlite3_stmt* statement;
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare(self->db, self->begin_statement, -1, &statement, &tail);
+ rc = sqlite3_prepare_v2(self->db, self->begin_statement, -1, &statement, &tail);
Py_END_ALLOW_THREADS
if (rc != SQLITE_OK) {
if (!sqlite3_get_autocommit(self->db)) {
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare(self->db, "COMMIT", -1, &statement, &tail);
+ rc = sqlite3_prepare_v2(self->db, "COMMIT", -1, &statement, &tail);
Py_END_ALLOW_THREADS
if (rc != SQLITE_OK) {
_pysqlite_seterror(self->db, NULL);
pysqlite_do_all_statements(self, ACTION_RESET, 1);
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare(self->db, "ROLLBACK", -1, &statement, &tail);
+ rc = sqlite3_prepare_v2(self->db, "ROLLBACK", -1, &statement, &tail);
Py_END_ALLOW_THREADS
if (rc != SQLITE_OK) {
_pysqlite_seterror(self->db, NULL);
goto error;
}
- /* Keep trying the SQL statement until the schema stops changing. */
- while (1) {
- /* Actually execute the SQL statement. */
- rc = pysqlite_step(self->statement->st, self->connection);
+ rc = pysqlite_step(self->statement->st, self->connection);
+ if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
if (PyErr_Occurred()) {
- (void)pysqlite_statement_reset(self->statement);
- goto error;
- }
- if (rc == SQLITE_DONE || rc == SQLITE_ROW) {
- /* If it worked, let's get out of the loop */
- break;
- }
- /* Something went wrong. Re-set the statement and try again. */
- rc = pysqlite_statement_reset(self->statement);
- if (rc == SQLITE_SCHEMA) {
- /* If this was a result of the schema changing, let's try
- again. */
- rc = pysqlite_statement_recompile(self->statement, parameters);
- if (rc == SQLITE_OK) {
- continue;
+ if (_enable_callback_tracebacks) {
+ PyErr_Print();
} else {
- /* If the database gave us an error, promote it to Python. */
- (void)pysqlite_statement_reset(self->statement);
- _pysqlite_seterror(self->connection->db, NULL);
- goto error;
- }
- } else {
- if (PyErr_Occurred()) {
- /* there was an error that occurred in a user-defined callback */
- if (_enable_callback_tracebacks) {
- PyErr_Print();
- } else {
- PyErr_Clear();
- }
+ PyErr_Clear();
}
- (void)pysqlite_statement_reset(self->statement);
- _pysqlite_seterror(self->connection->db, NULL);
- goto error;
}
+ (void)pysqlite_statement_reset(self->statement);
+ _pysqlite_seterror(self->connection->db, NULL);
+ goto error;
}
if (pysqlite_build_row_cast_map(self) != 0) {
while (1) {
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare(self->connection->db,
- script_cstr,
- -1,
- &statement,
- &script_cstr);
+ rc = sqlite3_prepare_v2(self->connection->db,
+ script_cstr,
+ -1,
+ &statement,
+ &script_cstr);
Py_END_ALLOW_THREADS
if (rc != SQLITE_OK) {
_pysqlite_seterror(self->connection->db, NULL);
static char *kwlist[] = {
"database", "timeout", "detect_types", "isolation_level",
- "check_same_thread", "factory", "cached_statements", "uri",
+ "check_same_thread", "factory", "cached_statements", "uri", "flags",
NULL
};
char* database;
PyObject* factory = NULL;
int check_same_thread = 1;
int cached_statements;
+ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
int uri = 0;
double timeout = 5.0;
PyObject* result;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|diOiOip", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|diOiOipi", kwlist,
&database, &timeout, &detect_types,
&isolation_level, &check_same_thread,
- &factory, &cached_statements, &uri))
+ &factory, &cached_statements, &uri,
+ &flags))
{
return NULL;
}
PyDoc_STRVAR(module_connect_doc,
"connect(database[, timeout, detect_types, isolation_level,\n\
- check_same_thread, factory, cached_statements, uri])\n\
+ check_same_thread, factory, cached_statements, uri, flags])\n\
\n\
Opens a connection to the SQLite database file *database*. You can use\n\
\":memory:\" to open a database connection to a database that resides in\n\
}
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare(connection->db,
- sql_cstr,
- -1,
- &self->st,
- &tail);
+ rc = sqlite3_prepare_v2(connection->db,
+ sql_cstr,
+ -1,
+ &self->st,
+ &tail);
Py_END_ALLOW_THREADS
self->db = connection->db;
}
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare(self->db,
- sql_cstr,
- -1,
- &new_st,
- &tail);
+ rc = sqlite3_prepare_v2(self->db,
+ sql_cstr,
+ -1,
+ &new_st,
+ &tail);
Py_END_ALLOW_THREADS
if (rc == SQLITE_OK) {