1--TEST-- 2PostgreSQL pg_update() - basic test using schema 3--SKIPIF-- 4<?php include("skipif.inc"); ?> 5--FILE-- 6<?php 7 8include('config.inc'); 9 10$conn = pg_connect($conn_str); 11 12pg_query('CREATE SCHEMA phptests'); 13 14pg_query('CREATE TABLE foo (id INT, id2 INT)'); 15pg_query('CREATE TABLE phptests.foo (id INT, id2 INT)'); 16 17 18pg_insert($conn, 'foo', array('id' => 1, 'id2' => 1)); 19pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2)); 20 21pg_update($conn, 'foo', array('id' => 10), array('id' => 1)); 22var_dump(pg_update($conn, 'foo', array('id' => 10), array('id' => 1), PGSQL_DML_STRING)); 23 24pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2)); 25var_dump(pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2), PGSQL_DML_STRING)); 26 27$rs = pg_query('SELECT * FROM foo UNION SELECT * FROM phptests.foo ORDER BY id'); 28while ($row = pg_fetch_assoc($rs)) { 29 var_dump($row); 30} 31 32pg_query('DROP TABLE foo'); 33pg_query('DROP TABLE phptests.foo'); 34pg_query('DROP SCHEMA phptests'); 35 36?> 37--EXPECT-- 38string(38) "UPDATE "foo" SET "id"=10 WHERE "id"=1;" 39string(51) "UPDATE "phptests"."foo" SET "id"=100 WHERE "id2"=2;" 40array(2) { 41 ["id"]=> 42 string(2) "10" 43 ["id2"]=> 44 string(1) "1" 45} 46array(2) { 47 ["id"]=> 48 string(3) "100" 49 ["id2"]=> 50 string(1) "2" 51} 52