]> granicus.if.org Git - php/commitdiff
Use PGSQL_CONV_FORCE_NULL as it is supposed.
authorYasuo Ohgaki <yohgaki@php.net>
Mon, 30 Sep 2002 07:35:41 +0000 (07:35 +0000)
committerYasuo Ohgaki <yohgaki@php.net>
Mon, 30 Sep 2002 07:35:41 +0000 (07:35 +0000)
PGSQL_CONV_FORCE_NULL inserts NULL to field instead of
NULL string for string type tuples.

ext/pgsql/pgsql.c

index 3cdb59a970ee5fdec7c8aee21a2f98c1341d6b5d..e2000a617b1f6692427a29ceedcb6941c7bcd051 100644 (file)
@@ -3269,7 +3269,12 @@ PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval
                                switch (Z_TYPE_PP(val)) {
                                        case IS_STRING:
                                                if (Z_STRLEN_PP(val) == 0) {
-                                                       ZVAL_STRING(new_val, empty_string, 1);
+                                                       if (opt & PGSQL_CONV_FORCE_NULL) {
+                                                               ZVAL_STRING(new_val, "NULL", 1);
+                                                       }
+                                                       else {
+                                                               ZVAL_STRING(new_val, empty_string, 1);
+                                                       }
                                                }
                                                else {
                                                        Z_TYPE_P(new_val) = IS_STRING;