Imported Upstream version 2.3.2 upstream/2.3.2
authorJoel Rosdahl <joel@debian.org>
Mon, 11 Jan 2010 20:37:35 +0000 (21:37 +0100)
committerJoel Rosdahl <joel@debian.org>
Mon, 11 Jan 2010 20:37:35 +0000 (21:37 +0100)
PKG-INFO
pysqlite2/test/types.py
setup.py
src/cursor.c
src/module.h

index 8548f4e..6bb3e72 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,11 @@
 Metadata-Version: 1.0
 Name: pysqlite
-Version: 2.3.1
+Version: 2.3.2
 Summary: DB-API 2.0 interface for SQLite 3.x
 Home-page: http://pysqlite.org/
 Author: Gerhard Haering
 Author-email: gh@ghaering.de
 License: zlib/libpng license
-Download-URL: http://initd.org/tracker/pysqlite/wiki/PysqliteDownloads
 Description: Python interface to SQLite 3
         
         pysqlite is an interface to the SQLite 3.x embedded relational database engine.
index f142280..34ebbea 100644 (file)
@@ -21,7 +21,7 @@
 #    misrepresented as being the original software.
 # 3. This notice may not be removed or altered from any source distribution.
 
-import datetime
+import bz2, datetime
 import unittest
 import pysqlite2.dbapi2 as sqlite
 
@@ -273,6 +273,23 @@ class ObjectAdaptationTests(unittest.TestCase):
         val = self.cur.fetchone()[0]
         self.failUnlessEqual(type(val), float)
 
+class BinaryConverterTests(unittest.TestCase):
+    def convert(s):
+        return bz2.decompress(s)
+    convert = staticmethod(convert)
+
+    def setUp(self):
+        self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
+        sqlite.register_converter("bin", BinaryConverterTests.convert)
+
+    def tearDown(self):
+        self.con.close()
+
+    def CheckBinaryInputForConverter(self):
+        testdata = "abcdefg" * 10
+        result = self.con.execute('select ? as "x [bin]"', (buffer(bz2.compress(testdata)),)).fetchone()[0]
+        self.failUnlessEqual(testdata, result)
+
 class DateTimeTests(unittest.TestCase):
     def setUp(self):
         self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES)
@@ -322,8 +339,9 @@ def suite():
     decltypes_type_suite = unittest.makeSuite(DeclTypesTests, "Check")
     colnames_type_suite = unittest.makeSuite(ColNamesTests, "Check")
     adaptation_suite = unittest.makeSuite(ObjectAdaptationTests, "Check")
+    bin_suite = unittest.makeSuite(BinaryConverterTests, "Check")
     date_suite = unittest.makeSuite(DateTimeTests, "Check")
-    return unittest.TestSuite((sqlite_type_suite, decltypes_type_suite, colnames_type_suite, adaptation_suite, date_suite))
+    return unittest.TestSuite((sqlite_type_suite, decltypes_type_suite, colnames_type_suite, adaptation_suite, bin_suite, date_suite))
 
 def test():
     runner = unittest.TextTestRunner()
index 9fdda4a..08d826b 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -122,7 +122,6 @@ def get_setup_args():
             license = "zlib/libpng license",
             platforms = "ALL",
             url = "http://pysqlite.org/",
-            download_url = "http://initd.org/tracker/pysqlite/wiki/PysqliteDownloads",
 
             # Description of the modules and packages in the distribution
             package_dir = {"pysqlite2": "pysqlite2"},
index 98f5e0d..94aea9b 100644 (file)
@@ -321,12 +321,13 @@ PyObject* _fetch_one_row(Cursor* self)
         }
 
         if (converter != Py_None) {
-            val_str = (const char*)sqlite3_column_text(self->statement->st, i);
+            nbytes = sqlite3_column_bytes(self->statement->st, i);
+            val_str = (const char*)sqlite3_column_blob(self->statement->st, i);
             if (!val_str) {
                 Py_INCREF(Py_None);
                 converted = Py_None;
             } else {
-                item = PyString_FromString(val_str);
+                item = PyString_FromStringAndSize(val_str, nbytes);
                 if (!item) {
                     return NULL;
                 }
index 3fdac61..e514bd1 100644 (file)
@@ -25,7 +25,7 @@
 #define PYSQLITE_MODULE_H
 #include "Python.h"
 
-#define PYSQLITE_VERSION "2.3.1"
+#define PYSQLITE_VERSION "2.3.2"
 
 extern PyObject* Error;
 extern PyObject* Warning;