From: Hyunjee Kim Date: Fri, 10 Apr 2020 05:16:16 +0000 (+0900) Subject: Imported Upstream version 0.1.2 X-Git-Tag: upstream/0.1.2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b3b2de278ac8177a5694fb22390a0b05b15169e;p=platform%2Fupstream%2Fpython3-sqlite.git Imported Upstream version 0.1.2 Change-Id: I0f92ecffef1026a2f77810df04b6797dcfd0f18a Signed-off-by: Hyunjee Kim --- diff --git a/PKG-INFO b/PKG-INFO index 5ecd1aa..bd795a6 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pysqlite3 -Version: 0.1.1 +Version: 0.1.2 Summary: DB-API 2.0 interface for Sqlite 3.x Home-page: https://github.com/rigglemania/pysqlcipher3 Author: Charles Leifer diff --git a/pysqlite3.egg-info/PKG-INFO b/pysqlite3.egg-info/PKG-INFO index 5ecd1aa..bd795a6 100644 --- a/pysqlite3.egg-info/PKG-INFO +++ b/pysqlite3.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pysqlite3 -Version: 0.1.1 +Version: 0.1.2 Summary: DB-API 2.0 interface for Sqlite 3.x Home-page: https://github.com/rigglemania/pysqlcipher3 Author: Charles Leifer diff --git a/setup.py b/setup.py index 0ef9ef7..3519be2 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from setuptools import Extension # If you need to change anything, it should be enough to change setup.cfg. PACKAGE_NAME = 'pysqlite3' -VERSION = '0.1.1' +VERSION = '0.1.2' # define sqlite sources sources = [os.path.join('src', source) diff --git a/src/cursor.c b/src/cursor.c index 1d7b63c..3706cb2 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -554,29 +554,29 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* goto error; } - if (rc == SQLITE_ROW || rc == SQLITE_DONE) { - Py_BEGIN_ALLOW_THREADS - numcols = sqlite3_column_count(self->statement->st); - Py_END_ALLOW_THREADS - if (self->description == Py_None && numcols > 0) { - Py_SETREF(self->description, PyTuple_New(numcols)); - if (!self->description) { + assert(rc == SQLITE_ROW || rc == SQLITE_DONE); + Py_BEGIN_ALLOW_THREADS + numcols = sqlite3_column_count(self->statement->st); + Py_END_ALLOW_THREADS + + if (self->description == Py_None && numcols > 0) { + Py_SETREF(self->description, PyTuple_New(numcols)); + if (!self->description) { + goto error; + } + for (i = 0; i < numcols; i++) { + descriptor = PyTuple_New(7); + if (!descriptor) { goto error; } - for (i = 0; i < numcols; i++) { - descriptor = PyTuple_New(7); - if (!descriptor) { - goto error; - } - PyTuple_SetItem(descriptor, 0, _pysqlite_build_column_name(sqlite3_column_name(self->statement->st, i))); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 4, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 5, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 6, Py_None); - PyTuple_SetItem(self->description, i, descriptor); - } + PyTuple_SetItem(descriptor, 0, _pysqlite_build_column_name(sqlite3_column_name(self->statement->st, i))); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 4, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 5, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 6, Py_None); + PyTuple_SetItem(self->description, i, descriptor); } } diff --git a/src/statement.c b/src/statement.c index 0f9c2f9..c7cf423 100644 --- a/src/statement.c +++ b/src/statement.c @@ -319,52 +319,6 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para } } -int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params) -{ - const char* tail; - int rc; - const char* sql_cstr; - Py_ssize_t sql_len; - sqlite3_stmt* new_st; - - sql_cstr = PyUnicode_AsUTF8AndSize(self->sql, &sql_len); - if (sql_cstr == NULL) { - rc = PYSQLITE_SQL_WRONG_TYPE; - return rc; - } - - Py_BEGIN_ALLOW_THREADS - rc = sqlite3_prepare_v2(self->db, - sql_cstr, - -1, - &new_st, - &tail); - Py_END_ALLOW_THREADS - - if (rc == SQLITE_OK) { - /* The efficient sqlite3_transfer_bindings is only available in SQLite - * version 3.2.2 or later. For older SQLite releases, that might not - * even define SQLITE_VERSION_NUMBER, we do it the manual way. - */ - #ifdef SQLITE_VERSION_NUMBER - #if SQLITE_VERSION_NUMBER >= 3002002 - /* The check for the number of parameters is necessary to not trigger a - * bug in certain SQLite versions (experienced in 3.2.8 and 3.3.4). */ - if (sqlite3_bind_parameter_count(self->st) > 0) { - (void)sqlite3_transfer_bindings(self->st, new_st); - } - #endif - #else - statement_bind_parameters(self, params); - #endif - - (void)sqlite3_finalize(self->st); - self->st = new_st; - } - - return rc; -} - int pysqlite_statement_finalize(pysqlite_Statement* self) { int rc; diff --git a/src/statement.h b/src/statement.h index 8db10f6..fd88d7d 100644 --- a/src/statement.h +++ b/src/statement.h @@ -50,7 +50,6 @@ void pysqlite_statement_dealloc(pysqlite_Statement* self); int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter); void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* parameters); -int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* parameters); int pysqlite_statement_finalize(pysqlite_Statement* self); int pysqlite_statement_reset(pysqlite_Statement* self); void pysqlite_statement_mark_dirty(pysqlite_Statement* self); diff --git a/src/util.c b/src/util.c index 351b1b4..bff6865 100644 --- a/src/util.c +++ b/src/util.c @@ -47,14 +47,12 @@ int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection) */ 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); + int errorcode = sqlite3_errcode(db); switch (errorcode) {