note 34111 added to function.pg-insert

From: Date: Wed, 16 Jul 2003 14:38:34 +0000
Subject: note 34111 added to function.pg-insert
Groups: php.notes 
Request: Send a blank email to php-notes+get-52199@lists.php.net to get a copy of this message
In source code of php 4.3.2 exists an error ext/pgsql/pgsql.c. In the function pg_convert (php_pgsql_convert) it is not necessary to specify the schema name. But in the sql statement insert it is. Below is the portion of the source code which needs to be fixed. line (HERE --> smart_str_appends(&querystr, table);) Must be something like : NEW HERE --> smart_str_appends(&querystr, schema); smart_str_appends(&querystr, "."); smart_str_appends(&querystr, table); the schema name can be obtained from realnamespace collumn (oid) from table pg_class. The source : PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC) { zval **val, *converted = NULL; char buf[256]; char *fld; smart_str querystr = {0}; int key_type, ret = FAILURE; uint fld_len; ulong num_idx; HashPosition pos; assert(pg_link != NULL); assert(table != NULL); assert(Z_TYPE_P(var_array) == IS_ARRAY); if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) { return FAILURE; } /* convert input array if needed */ if (!(opt & PGSQL_DML_NO_CONV)) { MAKE_STD_ZVAL(converted); array_init(converted); if (php_pgsql_convert(pg_link, table, var_array, converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) { goto cleanup; } var_array = converted; } smart_str_appends(&querystr, "INSERT INTO "); HERE --> smart_str_appends(&querystr, table); smart_str_appends(&querystr, " ("); ---- Manual Page -- http://www.php.net/manual/en/function.pg-insert.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34111 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34111&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34111&report=yes

« previous php.notes (#52199) next »