diff -r 14cb17682831 Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c Tue Apr 26 11:47:10 2016 +0000 +++ b/Modules/_sqlite/connection.c Sat Apr 30 13:16:16 2016 +0300 @@ -110,8 +110,13 @@ return -1; } Py_BEGIN_ALLOW_THREADS +#ifdef HAVE_SQLITE3_OPEN_V2 + rc = sqlite3_open_v2(database, &self->db, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); +#else rc = sqlite3_open(database, &self->db); #endif +#endif Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { @@ -250,7 +255,7 @@ /* Clean up if user has not called .close() explicitly. */ if (self->db) { Py_BEGIN_ALLOW_THREADS - sqlite3_close(self->db); + SQLITE3_CLOSE(self->db); Py_END_ALLOW_THREADS } @@ -337,7 +342,7 @@ if (self->db) { Py_BEGIN_ALLOW_THREADS - rc = sqlite3_close(self->db); + rc = SQLITE3_CLOSE(self->db); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { @@ -378,7 +383,7 @@ sqlite3_stmt* statement; Py_BEGIN_ALLOW_THREADS - rc = sqlite3_prepare(self->db, self->begin_statement, -1, &statement, &tail); + rc = SQLITE3_PREPARE(self->db, self->begin_statement, -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { @@ -424,7 +429,7 @@ pysqlite_do_all_statements(self, ACTION_RESET, 0); Py_BEGIN_ALLOW_THREADS - rc = sqlite3_prepare(self->db, "COMMIT", -1, &statement, &tail); + rc = SQLITE3_PREPARE(self->db, "COMMIT", -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { _pysqlite_seterror(self->db, NULL); @@ -470,7 +475,7 @@ pysqlite_do_all_statements(self, ACTION_RESET, 1); Py_BEGIN_ALLOW_THREADS - rc = sqlite3_prepare(self->db, "ROLLBACK", -1, &statement, &tail); + rc = SQLITE3_PREPARE(self->db, "ROLLBACK", -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { _pysqlite_seterror(self->db, NULL); diff -r 14cb17682831 Modules/_sqlite/cursor.c --- a/Modules/_sqlite/cursor.c Tue Apr 26 11:47:10 2016 +0000 +++ b/Modules/_sqlite/cursor.c Sat Apr 30 13:16:16 2016 +0300 @@ -788,7 +788,7 @@ while (1) { Py_BEGIN_ALLOW_THREADS - rc = sqlite3_prepare(self->connection->db, + rc = SQLITE3_PREPARE(self->connection->db, script_cstr, -1, &statement, diff -r 14cb17682831 Modules/_sqlite/statement.c --- a/Modules/_sqlite/statement.c Tue Apr 26 11:47:10 2016 +0000 +++ b/Modules/_sqlite/statement.c Sat Apr 30 13:16:16 2016 +0300 @@ -73,7 +73,7 @@ self->sql = sql; Py_BEGIN_ALLOW_THREADS - rc = sqlite3_prepare(connection->db, + rc = SQLITE3_PREPARE(connection->db, sql_cstr, -1, &self->st, @@ -314,7 +314,7 @@ } Py_BEGIN_ALLOW_THREADS - rc = sqlite3_prepare(self->db, + rc = SQLITE3_PREPARE(self->db, sql_cstr, -1, &new_st, diff -r 14cb17682831 Modules/_sqlite/util.h --- a/Modules/_sqlite/util.h Tue Apr 26 11:47:10 2016 +0000 +++ b/Modules/_sqlite/util.h Sat Apr 30 13:16:16 2016 +0300 @@ -39,4 +39,16 @@ PyObject * _pysqlite_long_from_int64(sqlite_int64 value); sqlite_int64 _pysqlite_long_as_int64(PyObject * value); +#ifdef HAVE_SQLITE3_PREPARE_V2 +#define SQLITE3_PREPARE sqlite3_prepare_v2 +#else +#define SQLITE3_PREPARE sqlite3_prepare #endif + +#ifdef HAVE_SQLITE3_CLOSE_V2 +#define SQLITE3_CLOSE sqlite3_close_v2 +#else +#define SQLITE3_CLOSE sqlite3_close +#endif + +#endif diff -r 14cb17682831 configure.ac --- a/configure.ac Tue Apr 26 11:47:10 2016 +0000 +++ b/configure.ac Sat Apr 30 13:16:16 2016 +0300 @@ -2707,6 +2707,14 @@ AC_MSG_RESULT($enable_loadable_sqlite_extensions) +# Check for support of sqlite3 _v2 interface +AC_CHECK_LIB(sqlite3, sqlite3_prepare_v2, + AC_DEFINE(HAVE_SQLITE3_PREPARE_V2, 1, [Define if the sqlite3 library has sqlite3_prepare_v2])) +AC_CHECK_LIB(sqlite3, sqlite3_open_v2, + AC_DEFINE(HAVE_SQLITE3_OPEN_V2, 1, [Define if the sqlite3 library has sqlite3_open_v2])) +AC_CHECK_LIB(sqlite3, sqlite3_close_v2, + AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [Define if the sqlite3 library has sqlite3_close_v2])) + # Check for --with-tcltk-includes=path and --with-tcltk-libs=path AC_SUBST(TCLTK_INCLUDES) AC_SUBST(TCLTK_LIBS) diff -r 14cb17682831 pyconfig.h.in --- a/pyconfig.h.in Tue Apr 26 11:47:10 2016 +0000 +++ b/pyconfig.h.in Sat Apr 30 13:16:16 2016 +0300 @@ -873,6 +873,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SPAWN_H +/* Define if the sqlite3 library has sqlite3_close_v2 */ +#undef HAVE_SQLITE3_CLOSE_V2 + +/* Define if the sqlite3 library has sqlite3_open_v2 */ +#undef HAVE_SQLITE3_OPEN_V2 + +/* Define if the sqlite3 library has sqlite3_prepare_v2 */ +#undef HAVE_SQLITE3_PREPARE_V2 + /* Define if your compiler provides ssize_t */ #undef HAVE_SSIZE_T