Imported Upstream version 0.1.1 upstream/0.1.1
authorHyunjee Kim <hj0426.kim@samsung.com>
Fri, 10 Apr 2020 05:15:41 +0000 (14:15 +0900)
committerHyunjee Kim <hj0426.kim@samsung.com>
Fri, 10 Apr 2020 05:16:00 +0000 (14:16 +0900)
Change-Id: Ifc5e364439ff87671d39a8f676422606f64aaef2
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
PKG-INFO
pysqlite3.egg-info/PKG-INFO
setup.cfg
setup.py
src/connection.c
src/cursor.c
src/module.c
src/statement.c

index 21bcc2c980eb0752a66bc22aa57b8c913ffc3d77..5ecd1aab75e5dc38aa484e1b1b5d398009e68c60 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 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
index 21bcc2c980eb0752a66bc22aa57b8c913ffc3d77..5ecd1aab75e5dc38aa484e1b1b5d398009e68c60 100644 (file)
@@ -1,6 +1,6 @@
 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
index f170bdfe605508a62ac168d7f5f7f00fc3d45c17..84432093433fef45137f74be826a9216fb7ab80a 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,5 +6,4 @@ library_dirs = /usr/lib
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
index d3eaf4ce3b64b53f8a5cbec19d617a828d690bf3..0ef9ef7894a8080650a38c124989d5a815b6f442 100644 (file)
--- 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.0'
+VERSION = '0.1.1'
 
 # define sqlite sources
 sources = [os.path.join('src', source)
index 1c6aa54c224d36eff47aec3d91ec0e0875d7c1ca..4ce58d988097d3a7d02b653cf01fe862b8cadab5 100644 (file)
@@ -71,7 +71,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
 {
     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
     };
 
@@ -81,14 +81,16 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
     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;
     }
@@ -110,15 +112,14 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
 #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
 
@@ -375,7 +376,7 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self)
     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) {
@@ -418,7 +419,7 @@ PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args)
     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);
@@ -462,7 +463,7 @@ PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args
         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);
index 82373409471a88d029e78e837159e885b516cb3c..1d7b63c77508837c9683ccf01a00ac3bab9e4048 100644 (file)
@@ -535,45 +535,18 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
             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) {
@@ -705,11 +678,11 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
 
     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);
index fb4c4320559ad7a016f0c1250c4d155b0c3b50f2..ed3367e5cfd98c18ee485e53395093d1626dbd6a 100644 (file)
@@ -52,7 +52,7 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
 
     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;
@@ -61,15 +61,17 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
     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;
     }
@@ -85,7 +87,7 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
 
 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\
index 087375be9b63d888a7f12b46feb18ddf8a17d18d..0f9c2f9ca95a3063890af3771b5edb9d60feb6ca 100644 (file)
@@ -93,11 +93,11 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
     }
 
     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;
@@ -334,11 +334,11 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params)
     }
 
     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) {