]> granicus.if.org Git - php/commitdiff
NULL columns are NULL pointers
authorWez Furlong <wez@php.net>
Thu, 17 Apr 2003 17:09:59 +0000 (17:09 +0000)
committerWez Furlong <wez@php.net>
Thu, 17 Apr 2003 17:09:59 +0000 (17:09 +0000)
ext/sqlite/sqlite.c

index 831cff2194cf607ecbe3d4b8680a37d60f0dabb3..c7ebf8b35eee8398435a54add1ac44ebbf88e6a6 100644 (file)
@@ -354,10 +354,18 @@ PHP_FUNCTION(sqlite_fetch_array)
        /* now populate the result */
        for (j = 0; j < res->ncolumns; j++) {
                if (mode & PHPSQLITE_NUM) {
-                       add_index_string(return_value, j, res->table[i + j], 1);
+                       if (res->table[i +j] == NULL) {
+                               add_index_null(return_value, j);
+                       } else {
+                               add_index_string(return_value, j, res->table[i + j], 1);
+                       }
                }
                if (mode & PHPSQLITE_ASSOC) {
-                       add_assoc_string(return_value, res->table[j], res->table[i + j], 1);
+                       if (res->table[i + j] == NULL) {
+                               add_assoc_null(return_value, res->table[j]);
+                       } else {
+                               add_assoc_string(return_value, res->table[j], res->table[i + j], 1);
+                       }
                }
        }