]> granicus.if.org Git - php/commitdiff
@- NULL values are now preserved in the return value of mysql_fetch_array()
authorAndrei Zmievski <andrei@php.net>
Mon, 15 May 2000 13:46:37 +0000 (13:46 +0000)
committerAndrei Zmievski <andrei@php.net>
Mon, 15 May 2000 13:46:37 +0000 (13:46 +0000)
@  and mysql_fetch_object(). (Andrei)

ext/mysql/php_mysql.c

index 94fda3bf4a03a389ae5fc0156f6071a2f0291273..def28dafedf6b6e916d505595bdcd7d8c9d2a382 100644 (file)
@@ -1317,8 +1317,11 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
                                add_assoc_stringl(return_value, mysql_field->name, data, data_len, should_copy);
                        }
                } else {
-                       /* NULL field, don't set it */
-                       /* add_get_index_stringl(return_value, i, empty_string, 0, (void **) &pval_ptr); */
+                       /* NULL value. */
+                       if (result_type & MYSQL_NUM)
+                               add_index_unset(return_value, i);
+                       else
+                               add_assoc_unset(return_value, mysql_field->name);
                }
        }
 }