yohgaki Mon Sep 30 05:07:58 2002 EDT
Modified files:
/php4/ext/pgsql pgsql.c php_pgsql.h
Log:
Added pg_fetch_assoc(). Fixed proto. Added/fixed comments.
# It seems last attempt was failed. Try committing again.
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.223 php4/ext/pgsql/pgsql.c:1.224
--- php4/ext/pgsql/pgsql.c:1.223 Mon Sep 30 03:35:41 2002
+++ php4/ext/pgsql/pgsql.c Mon Sep 30 05:07:57 2002
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.223 2002/09/30 07:35:41 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.224 2002/09/30 09:07:57 yohgaki Exp $ */
#include <stdlib.h>
@@ -95,6 +95,7 @@
/* 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 @@
}
/* }}} */
+/* {{{ 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 @@
}
/* }}} */
-/* {{{ 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 @@
}
/* }}} */
-/* {{{ 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 @@
}
/* }}} */
-/* {{{ 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 @@
}
/* }}} */
-/* {{{ 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 @@
}
/* }}} */
-/* {{{ 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)
{
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.47 php4/ext/pgsql/php_pgsql.h:1.48
--- php4/ext/pgsql/php_pgsql.h:1.47 Sun Jul 21 03:25:10 2002
+++ php4/ext/pgsql/php_pgsql.h Mon Sep 30 05:07:57 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pgsql.h,v 1.47 2002/07/21 07:25:10 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.48 2002/09/30 09:07:57 yohgaki Exp $ */
#ifndef PHP_PGSQL_H
#define PHP_PGSQL_H
@@ -76,6 +76,7 @@
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 @@
#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 */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php