helly Mon Mar 15 15:17:04 2004 EDT
Modified files:
/php-src/ext/pgsql pgsql.c
/php-src/ext/pgsql/tests 22pg_fetch_object.phpt
Log:
Keep BC of pg_fetch_object
http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.307&r2=1.308&ty=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.307 php-src/ext/pgsql/pgsql.c:1.308
--- php-src/ext/pgsql/pgsql.c:1.307 Mon Mar 15 14:47:15 2004
+++ php-src/ext/pgsql/pgsql.c Mon Mar 15 15:16:52 2004
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.307 2004/03/15 19:47:15 helly Exp $ */
+/* $Id: pgsql.c,v 1.308 2004/03/15 20:16:52 helly Exp $ */
#include <stdlib.h>
@@ -1417,10 +1417,10 @@
char *class_name;
int class_name_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|sz", &result,
&class_name, &class_name_len, &ctor_params) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|zsz", &result,
&zrow, &class_name, &class_name_len, &ctor_params) == FAILURE) {
return;
}
- if (ZEND_NUM_ARGS() < 2) {
+ if (ZEND_NUM_ARGS() < 3) {
ce = zend_standard_class_def;
} else {
ce = zend_fetch_class(class_name, class_name_len,
ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
@@ -1430,16 +1430,15 @@
return;
}
result_type = PGSQL_ASSOC;
- use_row = 0;
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|zl", &result,
&zrow, &result_type) == FAILURE) {
return;
}
- use_row = ZEND_NUM_ARGS() > 1 && Z_TYPE_P(zrow) != IS_NULL;
- if (use_row) {
- convert_to_long_ex(&zrow);
- row = Z_LVAL_P(zrow);
- }
+ }
+ use_row = ZEND_NUM_ARGS() > 1 && Z_TYPE_P(zrow) != IS_NULL;
+ if (use_row) {
+ convert_to_long_ex(&zrow);
+ row = Z_LVAL_P(zrow);
}
if (!(result_type & PGSQL_BOTH)) {
@@ -1600,7 +1599,7 @@
}
/* }}} */
-/* {{{ proto object pg_fetch_object(resource result [, string class_name [,
NULL|array ctor_params]])
+/* {{{ proto object pg_fetch_object(resource result [, int row [, string class_name
[, NULL|array ctor_params]]])
Fetch a row as an object */
PHP_FUNCTION(pg_fetch_object)
{
http://cvs.php.net/diff.php/php-src/ext/pgsql/tests/22pg_fetch_object.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/pgsql/tests/22pg_fetch_object.phpt
diff -u php-src/ext/pgsql/tests/22pg_fetch_object.phpt:1.1
php-src/ext/pgsql/tests/22pg_fetch_object.phpt:1.2
--- php-src/ext/pgsql/tests/22pg_fetch_object.phpt:1.1 Sat Sep 6 14:34:55 2003
+++ php-src/ext/pgsql/tests/22pg_fetch_object.phpt Mon Mar 15 15:16:59 2004
@@ -1,5 +1,5 @@
--TEST--
-PostgreSQL pg_fetch_*() functions
+PostgreSQL pg_fetch_object()
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
@@ -20,7 +20,7 @@
$result = pg_query($db, $sql) or die('Cannot qeury db');
$rows = pg_num_rows($result);
-var_dump(pg_fetch_object($result, 'test_class', array(1, 2)));
+var_dump(pg_fetch_object($result, NULL, 'test_class', array(1, 2)));
echo "Ok\n";
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php