diff Modules/_sqlite/cursor.c @ 38978:5dd736268ff4 legacy-trunk

The sqlite3 module did cut off data from the SQLite database at the first null character before sending it to a custom converter. This has been fixed now.
author Gerhard Häring <gh@ghaering.de>
date Sun, 02 Jul 2006 17:48:30 +0000
parents 3e5fd2b70e5a
children c4ac6ea497a1
line wrap: on
line diff
--- a/Modules/_sqlite/cursor.c	Sat Jul 01 16:28:20 2006 +0000
+++ b/Modules/_sqlite/cursor.c	Sun Jul 02 17:48:30 2006 +0000
@@ -321,12 +321,13 @@
         }
 
         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;
                 }