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