mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-40744: Drop support for SQLite pre 3.7.3 (GH-20909)
Remove code required to support SQLite pre 3.7.3. Co-written-by: Berker Peksag <berker.peksag@gmail.com> Co-written-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
This commit is contained in:
parent
22748a83d9
commit
207c321f13
12 changed files with 29 additions and 94 deletions
|
@ -29,8 +29,8 @@
|
|||
#include "microprotocols.h"
|
||||
#include "row.h"
|
||||
|
||||
#if SQLITE_VERSION_NUMBER >= 3003003
|
||||
#define HAVE_SHARED_CACHE
|
||||
#if SQLITE_VERSION_NUMBER < 3007003
|
||||
#error "SQLite 3.7.3 or higher required"
|
||||
#endif
|
||||
|
||||
/* static objects at module-level */
|
||||
|
@ -131,7 +131,6 @@ PyDoc_STRVAR(module_complete_doc,
|
|||
\n\
|
||||
Checks if a string contains a complete SQL statement. Non-standard.");
|
||||
|
||||
#ifdef HAVE_SHARED_CACHE
|
||||
static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyObject*
|
||||
kwargs)
|
||||
{
|
||||
|
@ -159,7 +158,6 @@ PyDoc_STRVAR(module_enable_shared_cache_doc,
|
|||
\n\
|
||||
Enable or disable shared cache mode for the calling thread.\n\
|
||||
Experimental/Non-standard.");
|
||||
#endif /* HAVE_SHARED_CACHE */
|
||||
|
||||
static PyObject* module_register_adapter(PyObject* self, PyObject* args)
|
||||
{
|
||||
|
@ -253,10 +251,8 @@ static PyMethodDef module_methods[] = {
|
|||
METH_VARARGS | METH_KEYWORDS, module_connect_doc},
|
||||
{"complete_statement", (PyCFunction)(void(*)(void))module_complete,
|
||||
METH_VARARGS | METH_KEYWORDS, module_complete_doc},
|
||||
#ifdef HAVE_SHARED_CACHE
|
||||
{"enable_shared_cache", (PyCFunction)(void(*)(void))module_enable_shared_cache,
|
||||
METH_VARARGS | METH_KEYWORDS, module_enable_shared_cache_doc},
|
||||
#endif
|
||||
{"register_adapter", (PyCFunction)module_register_adapter,
|
||||
METH_VARARGS, module_register_adapter_doc},
|
||||
{"register_converter", (PyCFunction)module_register_converter,
|
||||
|
@ -307,29 +303,17 @@ static const IntConstantPair _int_constants[] = {
|
|||
{"SQLITE_UPDATE", SQLITE_UPDATE},
|
||||
{"SQLITE_ATTACH", SQLITE_ATTACH},
|
||||
{"SQLITE_DETACH", SQLITE_DETACH},
|
||||
#if SQLITE_VERSION_NUMBER >= 3002001
|
||||
{"SQLITE_ALTER_TABLE", SQLITE_ALTER_TABLE},
|
||||
{"SQLITE_REINDEX", SQLITE_REINDEX},
|
||||
#endif
|
||||
#if SQLITE_VERSION_NUMBER >= 3003000
|
||||
{"SQLITE_ANALYZE", SQLITE_ANALYZE},
|
||||
#endif
|
||||
#if SQLITE_VERSION_NUMBER >= 3003007
|
||||
{"SQLITE_CREATE_VTABLE", SQLITE_CREATE_VTABLE},
|
||||
{"SQLITE_DROP_VTABLE", SQLITE_DROP_VTABLE},
|
||||
#endif
|
||||
#if SQLITE_VERSION_NUMBER >= 3003008
|
||||
{"SQLITE_FUNCTION", SQLITE_FUNCTION},
|
||||
#endif
|
||||
#if SQLITE_VERSION_NUMBER >= 3006008
|
||||
{"SQLITE_SAVEPOINT", SQLITE_SAVEPOINT},
|
||||
#endif
|
||||
#if SQLITE_VERSION_NUMBER >= 3008003
|
||||
{"SQLITE_RECURSIVE", SQLITE_RECURSIVE},
|
||||
#endif
|
||||
#if SQLITE_VERSION_NUMBER >= 3006011
|
||||
{"SQLITE_DONE", SQLITE_DONE},
|
||||
#endif
|
||||
{(char*)NULL, 0}
|
||||
};
|
||||
|
||||
|
@ -360,6 +344,11 @@ PyMODINIT_FUNC PyInit__sqlite3(void)
|
|||
PyObject *tmp_obj;
|
||||
int i;
|
||||
|
||||
if (sqlite3_libversion_number() < 3007003) {
|
||||
PyErr_SetString(PyExc_ImportError, MODULE_NAME ": SQLite 3.7.3 or higher required");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
module = PyModule_Create(&_sqlite3module);
|
||||
|
||||
if (!module ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue