summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pgsql/tests')
-rw-r--r--ext/pgsql/tests/03sync_query.phpt2
-rw-r--r--ext/pgsql/tests/04async_query.phpt2
-rw-r--r--ext/pgsql/tests/17result.phpt4
-rwxr-xr-xext/pgsql/tests/22pg_fetch_object.phpt37
4 files changed, 42 insertions, 3 deletions
diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt
index c65426d7d8..96827fe5a2 100644
--- a/ext/pgsql/tests/03sync_query.phpt
+++ b/ext/pgsql/tests/03sync_query.phpt
@@ -20,7 +20,7 @@ for ($i=0; $i < $rows; $i++)
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_object($result, $i, PGSQL_ASSOC);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++)
{
diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt
index 15728ec1ee..7711240a79 100644
--- a/ext/pgsql/tests/04async_query.phpt
+++ b/ext/pgsql/tests/04async_query.phpt
@@ -30,7 +30,7 @@ for ($i=0; $i < $rows; $i++)
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_object($result, $i, PGSQL_ASSOC);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++)
{
diff --git a/ext/pgsql/tests/17result.phpt b/ext/pgsql/tests/17result.phpt
index 265d00c657..c3f9959aa2 100644
--- a/ext/pgsql/tests/17result.phpt
+++ b/ext/pgsql/tests/17result.phpt
@@ -14,7 +14,8 @@ $sql = "SELECT * FROM $table_name";
$result = pg_query($db, $sql) or die('Cannot qeury db');
$rows = pg_num_rows($result);
-var_dump(pg_fetch_object($result, 1));
+var_dump(pg_result_seek($result, 1));
+var_dump(pg_fetch_object($result));
var_dump(pg_fetch_array($result, 1));
var_dump(pg_fetch_row($result, 1));
var_dump(pg_fetch_assoc($result, 1));
@@ -23,6 +24,7 @@ var_dump(pg_result_seek($result, 0));
echo "Ok\n";
?>
--EXPECT--
+bool(true)
object(stdClass)#1 (3) {
["num"]=>
string(1) "1"
diff --git a/ext/pgsql/tests/22pg_fetch_object.phpt b/ext/pgsql/tests/22pg_fetch_object.phpt
new file mode 100755
index 0000000000..d0b406d879
--- /dev/null
+++ b/ext/pgsql/tests/22pg_fetch_object.phpt
@@ -0,0 +1,37 @@
+--TEST--
+PostgreSQL pg_fetch_*() functions
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+class test_class {
+ function __construct($arg1, $arg2) {
+ echo __METHOD__ . "($arg1,$arg2)\n";
+ }
+}
+
+$db = pg_connect($conn_str);
+
+$sql = "SELECT * FROM $table_name";
+$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)));
+
+echo "Ok\n";
+?>
+--EXPECT--
+test_class::__construct(1,2)
+object(test_class)#1 (3) {
+ ["num"]=>
+ string(1) "0"
+ ["str"]=>
+ string(3) "ABC"
+ ["bin"]=>
+ NULL
+}
+Ok