summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-04-25 07:52:01 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-04-25 07:52:01 +0000
commitc5b4a507fe940e9fd2767df55b2c9c6efec9fd2f (patch)
tree7352d5a88279167d87c47e00ed23d4d609ccbbd4 /ext/pgsql/tests
parentb4c943ee7b70f9d907cad63a416cccc478ccde6d (diff)
downloadphp-git-c5b4a507fe940e9fd2767df55b2c9c6efec9fd2f.tar.gz
Added test for pg_fetch_*() functions
Diffstat (limited to 'ext/pgsql/tests')
-rw-r--r--ext/pgsql/tests/17result.phpt40
-rw-r--r--ext/pgsql/tests/result.inc21
2 files changed, 61 insertions, 0 deletions
diff --git a/ext/pgsql/tests/17result.phpt b/ext/pgsql/tests/17result.phpt
new file mode 100644
index 0000000000..33acb3a682
--- /dev/null
+++ b/ext/pgsql/tests/17result.phpt
@@ -0,0 +1,40 @@
+--TEST--
+PostgreSQL pg_fetch_*() functions
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+include("result.inc");
+?>
+--EXPECT--
+object(stdClass)(3) {
+ ["num"]=>
+ string(1) "1"
+ ["str"]=>
+ string(3) "ABC"
+ ["bin"]=>
+ NULL
+}
+array(6) {
+ [0]=>
+ string(1) "1"
+ ["num"]=>
+ string(1) "1"
+ [1]=>
+ string(3) "ABC"
+ ["str"]=>
+ string(3) "ABC"
+ [2]=>
+ NULL
+ ["bin"]=>
+ NULL
+}
+array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(3) "ABC"
+ [2]=>
+ NULL
+}
+Ok
diff --git a/ext/pgsql/tests/result.inc b/ext/pgsql/tests/result.inc
new file mode 100644
index 0000000000..6982a84493
--- /dev/null
+++ b/ext/pgsql/tests/result.inc
@@ -0,0 +1,21 @@
+<?php
+error_reporting(E_ALL);
+
+include 'config.inc';
+
+$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);
+
+$rec = pg_fetch_object($result, 1);
+var_dump($rec);
+$rec = pg_fetch_array($result, 1);
+var_dump($rec);
+$rec = pg_fetch_row($result, 1);
+var_dump($rec);
+
+echo "Ok\n";
+
+?> \ No newline at end of file