cvs: php4 /ext/pgsql pgsql.c
| From: | Yasuo Ohgaki | Date: | Sat, 20 Jul 2002 07:45:02 +0000 |
| Subject: | cvs: php4 /ext/pgsql pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12895@lists.php.net to get a copy of this message | ||
yohgaki Sat Jul 20 03:45:02 2002 EDT
Modified files:
/php4/ext/pgsql pgsql.c
Log:
Fixed php_pgsql_convert's bool type handling.
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.209 php4/ext/pgsql/pgsql.c:1.210
--- php4/ext/pgsql/pgsql.c:1.209 Sat Jul 20 03:24:15 2002
+++ php4/ext/pgsql/pgsql.c Sat Jul 20 03:45:01 2002
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.209 2002/07/20 07:24:15 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.210 2002/07/20 07:45:01 yohgaki Exp $ */
#include <stdlib.h>
@@ -3190,16 +3190,14 @@
!strcmp(Z_STRVAL_PP(val), "true") || !strcmp(Z_STRVAL_PP(val), "True")
||
!strcmp(Z_STRVAL_PP(val), "yes") || !strcmp(Z_STRVAL_PP(val), "Yes") ||
!strcmp(Z_STRVAL_PP(val), "1")) {
- Z_STRVAL_P(new_val) = estrdup("'t'");
- Z_STRLEN_P(new_val) = 1;
+ ZVAL_STRING(new_val, "'t'", 1);
}
else if (!strcmp(Z_STRVAL_PP(val), "f") || !strcmp(Z_STRVAL_PP(val),
"F") ||
!strcmp(Z_STRVAL_PP(val), "n") || !strcmp(Z_STRVAL_PP(val), "N") ||
!strcmp(Z_STRVAL_PP(val), "false") || !strcmp(Z_STRVAL_PP(val),
"False") ||
!strcmp(Z_STRVAL_PP(val), "no") || !strcmp(Z_STRVAL_PP(val), "No")
||
!strcmp(Z_STRVAL_PP(val), "0")) {
- Z_STRVAL_P(new_val) = estrdup("'f'");
- Z_STRLEN_P(new_val) = 1;
+ ZVAL_STRING(new_val, "'f'", 1);
}
else {
php_error(E_NOTICE, "%s() detected invalid value (%s) for pgsql %s field (%s)",
@@ -3212,12 +3210,11 @@
case IS_LONG:
case IS_BOOL:
if (Z_LVAL_PP(val)) {
- Z_STRVAL_P(new_val) = estrdup("'t'");
+ ZVAL_STRING(new_val, "'t'", 1);
}
else {
- Z_STRVAL_P(new_val) = estrdup("'f'");
+ ZVAL_STRING(new_val, "'f'", 1);
}
- Z_STRLEN_P(new_val) = 1;
break;
case IS_NULL:
@@ -3827,8 +3824,8 @@
break;
default:
/* should not happen */
- php_error(E_WARNING, "%s(): Report this error to php-dev@lists.php.net",
- get_active_function_name(TSRMLS_C));
+ php_error(E_WARNING, "%s(): Report this error to php-dev@lists.php.net. Type = %d",
+ get_active_function_name(TSRMLS_C), Z_TYPE_PP(val));
goto cleanup;
break;
}