Browse Source

Added pg_fetch_assoc(). Fixed proto. Added/fixed comments.

# It seems last attempt was failed. Try committing again.
migration/unlabaled-1.1.2
Yasuo Ohgaki 24 years ago
parent
commit
545f894524
  1. 25
      ext/pgsql/pgsql.c
  2. 3
      ext/pgsql/php_pgsql.h

25
ext/pgsql/pgsql.c

@ -95,6 +95,7 @@ function_entry pgsql_functions[] = {
/* result functions */
PHP_FE(pg_fetch_result, NULL)
PHP_FE(pg_fetch_row, NULL)
PHP_FE(pg_fetch_assoc, NULL)
PHP_FE(pg_fetch_array, NULL)
PHP_FE(pg_fetch_object, NULL)
PHP_FE(pg_fetch_all, NULL)
@ -1326,6 +1327,18 @@ PHP_FUNCTION(pg_fetch_row)
}
/* }}} */
/* {{{ proto array pg_fetch_assoc(resource result [, int row])
Fetch a row as an assoc array */
PHP_FUNCTION(pg_fetch_assoc)
{
/* pg_fetch_assoc() is added from PHP 4.3.0. It should raise error, when
there is 3rd parameter */
if (ZEND_NUM_ARGS() > 2)
WRONG_PARAM_COUNT;
php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC);
}
/* }}} */
/* {{{ proto array pg_fetch_array(resource result [, int row [, int result_type]])
Fetch a row as an array */
PHP_FUNCTION(pg_fetch_array)
@ -1334,10 +1347,12 @@ PHP_FUNCTION(pg_fetch_array)
}
/* }}} */
/* {{{ proto object pg_fetch_object(resource result [, int row[, int result_type]])
/* {{{ proto object pg_fetch_object(resource result [, int row])
Fetch a row as an object */
PHP_FUNCTION(pg_fetch_object)
{
/* pg_fetch_object() allowed result_type used to be. 3rd parameter
must be allowed for compatibility */
php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC);
if (Z_TYPE_P(return_value)==IS_ARRAY) {
object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
@ -3794,7 +3809,7 @@ cleanup:
}
/* }}} */
/* {{{ proto bool pg_insert(resource db, string table, array values[, int options])
/* {{{ proto mixed pg_insert(resource db, string table, array values[, int options])
Insert values (filed=>value) to table */
PHP_FUNCTION(pg_insert)
{
@ -3943,7 +3958,7 @@ cleanup:
}
/* }}} */
/* {{{ proto bool pg_update(resource db, string table, array fields, array ids[, int options])
/* {{{ proto mixed pg_update(resource db, string table, array fields, array ids[, int options])
Update table using values (field=>value) and ids (id=>value) */
PHP_FUNCTION(pg_update)
{
@ -4032,7 +4047,7 @@ cleanup:
}
/* }}} */
/* {{{ proto bool pg_delete(resource db, string table, array ids[, int options])
/* {{{ proto mixed pg_delete(resource db, string table, array ids[, int options])
Delete records has ids (id=>value) */
PHP_FUNCTION(pg_delete)
{
@ -4169,7 +4184,7 @@ cleanup:
}
/* }}} */
/* {{{ proto array pg_select(resource db, string table, array ids[, int options])
/* {{{ proto mixed pg_select(resource db, string table, array ids[, int options])
Select records that has ids (id=>value) */
PHP_FUNCTION(pg_select)
{

3
ext/pgsql/php_pgsql.h

@ -76,6 +76,7 @@ PHP_FUNCTION(pg_query);
PHP_FUNCTION(pg_send_query);
PHP_FUNCTION(pg_cancel_query);
/* result functions */
PHP_FUNCTION(pg_fetch_assoc);
PHP_FUNCTION(pg_fetch_array);
PHP_FUNCTION(pg_fetch_object);
PHP_FUNCTION(pg_fetch_result);
@ -142,7 +143,7 @@ PHP_FUNCTION(pg_select);
#define PGSQL_CONV_IGNORE_NOT_NULL (1<<3) /* Ignore NOT NULL constraints */
#define PGSQL_CONV_OPTS (PGSQL_CONV_IGNORE_DEFAULT|PGSQL_CONV_FORCE_NULL|PGSQL_CONV_IGNORE_NOT_NULL)
/* php_pgsql_insert/update/select/delete options */
#define PGSQL_DML_NO_CONV (1<<8) /* Call php_pgsql_convert() */
#define PGSQL_DML_NO_CONV (1<<8) /* Do not call php_pgsql_convert() */
#define PGSQL_DML_EXEC (1<<9) /* Execute query */
#define PGSQL_DML_ASYNC (1<<10) /* Do async query */
#define PGSQL_DML_STRING (1<<11) /* Return query string */

Loading…
Cancel
Save