1--TEST--
2PostgreSQL sync query params
3--SKIPIF--
4<?php
5include("skipif.inc");
6if (!function_exists('pg_query_params')) die('skip function pg_query_params() does not exist');
7?>
8--FILE--
9<?php
10
11include('config.inc');
12
13$db = pg_connect($conn_str);
14
15$version = pg_version($db);
16if ($version['protocol'] >= 3) {
17    $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
18    if (!($rows   = pg_num_rows($result)))
19    {
20        echo "pg_num_row() error\n";
21    }
22    for ($i=0; $i < $rows; $i++)
23    {
24        pg_fetch_array($result, $i, PGSQL_NUM);
25    }
26    for ($i=0; $i < $rows; $i++)
27    {
28        pg_fetch_object($result);
29    }
30    for ($i=0; $i < $rows; $i++)
31    {
32        pg_fetch_row($result, $i);
33    }
34    for ($i=0; $i < $rows; $i++)
35    {
36        pg_fetch_result($result, $i, 0);
37    }
38
39    pg_result_error($result);
40    pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
41    pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
42    pg_field_name($result, 0);
43    pg_field_num($result, $field_name);
44    pg_field_size($result, 0);
45    pg_field_type($result, 0);
46    pg_field_prtlen($result, 0);
47    pg_field_is_null($result, 0);
48
49    $result = pg_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
50    pg_last_oid($result);
51
52    pg_free_result($result);
53}
54pg_close($db);
55
56echo "OK";
57?>
58--EXPECT--
59OK
60