2002-04-25 15:52:01 +08:00
|
|
|
--TEST--
|
|
|
|
PostgreSQL pg_fetch_*() functions
|
|
|
|
--SKIPIF--
|
|
|
|
<?php include("skipif.inc"); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2003-05-20 08:14:46 +08:00
|
|
|
error_reporting(E_ALL);
|
|
|
|
|
|
|
|
include 'config.inc';
|
|
|
|
|
|
|
|
$db = pg_connect($conn_str);
|
|
|
|
|
2019-06-04 18:18:21 +08:00
|
|
|
$sql = "SELECT * FROM $table_name ORDER BY num";
|
2018-11-20 04:17:21 +08:00
|
|
|
$result = pg_query($db, $sql) or die('Cannot query db');
|
2003-05-20 08:14:46 +08:00
|
|
|
$rows = pg_num_rows($result);
|
|
|
|
|
2003-09-07 02:34:55 +08:00
|
|
|
var_dump(pg_result_seek($result, 1));
|
|
|
|
var_dump(pg_fetch_object($result));
|
2003-05-20 08:14:46 +08:00
|
|
|
var_dump(pg_fetch_array($result, 1));
|
|
|
|
var_dump(pg_fetch_row($result, 1));
|
|
|
|
var_dump(pg_fetch_assoc($result, 1));
|
|
|
|
var_dump(pg_result_seek($result, 0));
|
|
|
|
|
|
|
|
echo "Ok\n";
|
2002-04-25 15:52:01 +08:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
2003-09-07 02:34:55 +08:00
|
|
|
bool(true)
|
2003-05-20 08:14:46 +08:00
|
|
|
object(stdClass)#1 (3) {
|
2002-04-25 15:52:01 +08:00
|
|
|
["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
|
|
|
|
}
|
2002-10-18 15:52:09 +08:00
|
|
|
array(3) {
|
|
|
|
["num"]=>
|
2003-05-20 08:14:46 +08:00
|
|
|
string(1) "1"
|
2002-10-18 15:52:09 +08:00
|
|
|
["str"]=>
|
|
|
|
string(3) "ABC"
|
|
|
|
["bin"]=>
|
|
|
|
NULL
|
|
|
|
}
|
|
|
|
bool(true)
|
2002-04-25 15:52:01 +08:00
|
|
|
Ok
|