]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
upgrade to final version of pysqlite 2.2.0
authorAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Apr 2006 18:25:33 +0000 (18:25 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Apr 2006 18:25:33 +0000 (18:25 +0000)
Modules/_sqlite/cache.c
Modules/_sqlite/connection.c
Modules/_sqlite/cursor.c
Modules/_sqlite/microprotocols.c
Modules/_sqlite/module.c
Modules/_sqlite/module.h
Modules/_sqlite/prepare_protocol.c
Modules/_sqlite/row.c
Modules/_sqlite/statement.c
PCbuild/_sqlite3.vcproj
setup.py

index d36b52be0aca0893007c21f84831c6de94c13726..d102e97875054923c4843bebca5627be703430d5 100644 (file)
@@ -262,7 +262,7 @@ static PyMethodDef cache_methods[] = {
 PyTypeObject NodeType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
-        "pysqlite2.dbapi2.Node",                        /* tp_name */
+        MODULE_NAME "Node",                             /* tp_name */
         sizeof(Node),                                   /* tp_basicsize */
         0,                                              /* tp_itemsize */
         (destructor)node_dealloc,                       /* tp_dealloc */
@@ -305,7 +305,7 @@ PyTypeObject NodeType = {
 PyTypeObject CacheType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
-        "pysqlite2.dbapi2.Cache",                       /* tp_name */
+        MODULE_NAME ".Cache",                           /* tp_name */
         sizeof(Cache),                                  /* tp_basicsize */
         0,                                              /* tp_itemsize */
         (destructor)cache_dealloc,                      /* tp_dealloc */
index 3e97f6e739cb1212f8588751e05084c6044498dd..0f68160bde3155a989bd4b9bbd15cca36a27cc27 100644 (file)
@@ -1029,7 +1029,7 @@ static struct PyMemberDef connection_members[] =
 PyTypeObject ConnectionType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
-        "pysqlite2.dbapi2.Connection",                  /* tp_name */
+        MODULE_NAME ".Connection",                      /* tp_name */
         sizeof(Connection),                             /* tp_basicsize */
         0,                                              /* tp_itemsize */
         (destructor)connection_dealloc,                 /* tp_dealloc */
index 7f378d675406a7ee4bfa4888d1e36c9c6c2cac19..d2b45a00645212aa9c61c42122c5386e776a29e4 100644 (file)
@@ -977,7 +977,7 @@ static struct PyMemberDef cursor_members[] =
 PyTypeObject CursorType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
-        "pysqlite2.dbapi2.Cursor",                      /* tp_name */
+        MODULE_NAME ".Cursor",                          /* tp_name */
         sizeof(Cursor),                                 /* tp_basicsize */
         0,                                              /* tp_itemsize */
         (destructor)cursor_dealloc,                     /* tp_dealloc */
index 5040acdc0decc383e711b5513fa13e31b3dd1c44..4956ac073b73014f59570b7ee6af7017e9d249b8 100644 (file)
@@ -55,28 +55,19 @@ int
 microprotocols_add(PyTypeObject *type, PyObject *proto, PyObject *cast)
 {
     PyObject* key;
+    int rc;
 
     if (proto == NULL) proto = (PyObject*)&SQLitePrepareProtocolType;
 
-    /*
-    Dprintf("microprotocols_add: cast %p for (%s, ?)",
-            cast, type->tp_name);
-    */
-
-
     key = Py_BuildValue("(OO)", (PyObject*)type, proto);
     if (!key) {
         return -1;
     }
 
-    if (PyDict_SetItem(psyco_adapters, key, cast) != 0) {
-        Py_DECREF(key);
-        return -1;
-    }
-
+    rc = PyDict_SetItem(psyco_adapters, key, cast);
     Py_DECREF(key);
 
-    return 0;
+    return rc;
 }
 
 /* microprotocols_adapt - adapt an object to the built-in protocol */
index 60d0d6319d1b532d6e5f3043480a4acd130d8e5b..1537e795c57df00b0cd1d4d7d650b750f5100a5a 100644 (file)
@@ -214,56 +214,56 @@ PyMODINIT_FUNC init_sqlite3(void)
 
     /*** Create DB-API Exception hierarchy */
 
-    if (!(Error = PyErr_NewException("sqlite3.Error", PyExc_StandardError, NULL))) {
+    if (!(Error = PyErr_NewException(MODULE_NAME ".Error", PyExc_StandardError, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "Error", Error);
 
-    if (!(Warning = PyErr_NewException("sqlite3.Warning", PyExc_StandardError, NULL))) {
+    if (!(Warning = PyErr_NewException(MODULE_NAME ".Warning", PyExc_StandardError, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "Warning", Warning);
 
     /* Error subclasses */
 
-    if (!(InterfaceError = PyErr_NewException("sqlite3.InterfaceError", Error, NULL))) {
+    if (!(InterfaceError = PyErr_NewException(MODULE_NAME ".InterfaceError", Error, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "InterfaceError", InterfaceError);
 
-    if (!(DatabaseError = PyErr_NewException("sqlite3.DatabaseError", Error, NULL))) {
+    if (!(DatabaseError = PyErr_NewException(MODULE_NAME ".DatabaseError", Error, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "DatabaseError", DatabaseError);
 
     /* DatabaseError subclasses */
 
-    if (!(InternalError = PyErr_NewException("sqlite3.InternalError", DatabaseError, NULL))) {
+    if (!(InternalError = PyErr_NewException(MODULE_NAME ".InternalError", DatabaseError, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "InternalError", InternalError);
 
-    if (!(OperationalError = PyErr_NewException("sqlite3.OperationalError", DatabaseError, NULL))) {
+    if (!(OperationalError = PyErr_NewException(MODULE_NAME ".OperationalError", DatabaseError, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "OperationalError", OperationalError);
 
-    if (!(ProgrammingError = PyErr_NewException("sqlite3.ProgrammingError", DatabaseError, NULL))) {
+    if (!(ProgrammingError = PyErr_NewException(MODULE_NAME ".ProgrammingError", DatabaseError, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "ProgrammingError", ProgrammingError);
 
-    if (!(IntegrityError = PyErr_NewException("sqlite3.IntegrityError", DatabaseError,NULL))) {
+    if (!(IntegrityError = PyErr_NewException(MODULE_NAME ".IntegrityError", DatabaseError,NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "IntegrityError", IntegrityError);
 
-    if (!(DataError = PyErr_NewException("sqlite3.DataError", DatabaseError, NULL))) {
+    if (!(DataError = PyErr_NewException(MODULE_NAME ".DataError", DatabaseError, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "DataError", DataError);
 
-    if (!(NotSupportedError = PyErr_NewException("sqlite3.NotSupportedError", DatabaseError, NULL))) {
+    if (!(NotSupportedError = PyErr_NewException(MODULE_NAME ".NotSupportedError", DatabaseError, NULL))) {
         goto error;
     }
     PyDict_SetItemString(dict, "NotSupportedError", NotSupportedError);
@@ -320,6 +320,6 @@ PyMODINIT_FUNC init_sqlite3(void)
 error:
     if (PyErr_Occurred())
     {
-        PyErr_SetString(PyExc_ImportError, "_sqlite3: init failed");
+        PyErr_SetString(PyExc_ImportError, MODULE_NAME ": init failed");
     }
 }
index 75fe29d4830f1656f4e09ee29cc5458f8cff0d7b..6694735f481b6824ad478f3852253436ec1c025f 100644 (file)
@@ -25,6 +25,8 @@
 #define PYSQLITE_MODULE_H
 #include "Python.h"
 
+#define PYSQLITE_VERSION "2.2.0"
+
 extern PyObject* Error;
 extern PyObject* Warning;
 extern PyObject* InterfaceError;
index 522f1d107f3ae82a77adc5716cace0bdc08934a3..26b663be1c0649b65ca691a8c54f3d03ec2e7df4 100644 (file)
@@ -36,7 +36,7 @@ void prepare_protocol_dealloc(SQLitePrepareProtocol* self)
 PyTypeObject SQLitePrepareProtocolType= {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
-        "pysqlite2.dbapi2.PrepareProtocol",             /* tp_name */
+        MODULE_NAME ".PrepareProtocol",                 /* tp_name */
         sizeof(SQLitePrepareProtocol),                  /* tp_basicsize */
         0,                                              /* tp_itemsize */
         (destructor)prepare_protocol_dealloc,           /* tp_dealloc */
index 77c7896e5bcbbefae8f81ca055faae54da13ef7d..80b6135549e3f0503f5ccf749b2bcbb4fd187c45 100644 (file)
@@ -154,7 +154,7 @@ PyMappingMethods row_as_mapping = {
 PyTypeObject RowType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
-        "pysqlite2.dbapi2.Row",                         /* tp_name */
+        MODULE_NAME ".Row",                             /* tp_name */
         sizeof(Row),                                    /* tp_basicsize */
         0,                                              /* tp_itemsize */
         (destructor)row_dealloc,                        /* tp_dealloc */
index ae48b4b99bd1c1881312ab99ef0d1c808067b254..a8a9cf56d407a3dc6ee5a8aecbaf76703e0ccc4b 100644 (file)
@@ -381,7 +381,7 @@ int check_remaining_sql(const char* tail)
 PyTypeObject StatementType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
-        "pysqlite2.dbapi2.Statement",                   /* tp_name */
+        MODULE_NAME ".Statement",                       /* tp_name */
         sizeof(Statement),                              /* tp_basicsize */
         0,                                              /* tp_itemsize */
         (destructor)statement_dealloc,                  /* tp_dealloc */
index a24c5e6780d1d841f075fb244b784279c5180f14..bdb1a9bcbc4f5e78f5409477f1d4f766a99a2773 100644 (file)
@@ -22,7 +22,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"
-                               PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;PYSQLITE_VERSION=\&quot;2.2.0\&quot;"
+                               PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
                                RuntimeLibrary="3"
                                UsePrecompiledHeader="2"
                                WarningLevel="3"
@@ -77,7 +77,7 @@
                                Optimization="2"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"
-                               PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PYSQLITE_VERSION=\&quot;2.2.0\&quot;"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
                                StringPooling="TRUE"
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="TRUE"
                                Optimization="2"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="{MSSDKPATH}\include\Win64\atl;{MSSDKPATH}\include\Win64\crt;{MSSDKPATH}\include\Win64\crt\sys;{MSSDKPATH}\include\Win64\mfc;..\Include;..\PC;..\..\sqlite-source-3.3.4"
-                               PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PYSQLITE_VERSION=\&quot;2.2.0\&quot;"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
                                StringPooling="TRUE"
                                BasicRuntimeChecks="0"
                                RuntimeLibrary="2"
                                Optimization="2"
                                InlineFunctionExpansion="1"
                                AdditionalIncludeDirectories="{MSSDKPATH}\include\Win64\atl\amd64;{MSSDKPATH}\include\Win64\crt\amd64;{MSSDKPATH}\include\Win64\crt\amd64\sys;{MSSDKPATH}\include\Win64\mfc\amd64;..\Include;..\PC;..\..\sqlite-source-3.3.4"
-                               PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PYSQLITE_VERSION=\&quot;2.2.0\&quot;"
+                               PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;MODULE_NAME=\&quot;sqlite3\&quot;"
                                StringPooling="TRUE"
                                BasicRuntimeChecks="0"
                                RuntimeLibrary="2"
index cb1d1086c2b1ac20c86014a40aaa58e440dd13de..fb33bba8a77f7c04ca2d58cf03906c7d1155cfaa 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -755,11 +755,10 @@ class PyBuildExt(build_ext):
             PYSQLITE_VERSION = "2.2.0"
             sqlite_defines = []
             if sys.platform != "win32":
-                sqlite_defines.append(('PYSQLITE_VERSION',
-                                        '"%s"' % PYSQLITE_VERSION))
+                sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
             else:
-                sqlite_defines.append(('PYSQLITE_VERSION',
-                                        '\\"'+PYSQLITE_VERSION+'\\"'))
+                sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
+
             sqlite_defines.append(('PY_MAJOR_VERSION',
                                         str(sys.version_info[0])))
             sqlite_defines.append(('PY_MINOR_VERSION',