summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2002-04-22 08:18:19 +0000
committerSascha Schumann <sas@php.net>2002-04-22 08:18:19 +0000
commitebd957f69e6f27dce0d37c95fc7754c57aa34ca5 (patch)
tree2c7349900d31458d609599446d1532288617f772 /ext/pgsql/pgsql.c
parent865c2b7ca4e007972a5757f1deca89c30ecb2d7d (diff)
downloadphp-git-ebd957f69e6f27dce0d37c95fc7754c57aa34ca5.tar.gz
hash keys lengths include the NUL-byte, so we need to copy one byte less.
also add missing commas in the INSERT clause. Noticed by: Yasuo Ohgaki
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index fc1d8fc311..fe49782b36 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -3908,9 +3908,11 @@ PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array,
get_active_function_name(TSRMLS_C));
goto cleanup;
}
- smart_str_appendl(&querystr, fld, fld_len);
+ smart_str_appendl(&querystr, fld, fld_len - 1);
+ smart_str_appendc(&querystr, ',');
zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos);
}
+ querystr.len--;
smart_str_appends(&querystr, ") VALUES (");
/* make values string */
@@ -4004,7 +4006,7 @@ static inline int build_assignment_string(smart_str *querystr, HashTable *ht, co
get_active_function_name(TSRMLS_C));
return -1;
}
- smart_str_appendl(querystr, fld, fld_len);
+ smart_str_appendl(querystr, fld, fld_len - 1);
smart_str_appendc(querystr, '=');
switch(Z_TYPE_PP(val)) {