mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Added test for pg_fetch_*() functions
This commit is contained in:
parent
b4c943ee7b
commit
c5b4a507fe
40
ext/pgsql/tests/17result.phpt
Normal file
40
ext/pgsql/tests/17result.phpt
Normal file
@ -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
|
21
ext/pgsql/tests/result.inc
Normal file
21
ext/pgsql/tests/result.inc
Normal file
@ -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";
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user