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