1--TEST-- 2PostgreSQL pg_select() - 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 phptests.foo (id INT, id2 INT)'); 15pg_query('INSERT INTO phptests.foo VALUES (1,2)'); 16pg_query('INSERT INTO phptests.foo VALUES (2,3)'); 17 18pg_query('CREATE TABLE phptests.bar (id4 INT, id3 INT)'); 19pg_query('INSERT INTO phptests.bar VALUES (4,5)'); 20pg_query('INSERT INTO phptests.bar VALUES (6,7)'); 21 22/* Inexistent table */ 23var_dump(pg_select($conn, 'foo', array('id' => 1))); 24 25/* Existent column */ 26var_dump(pg_select($conn, 'phptests.foo', array('id' => 1))); 27 28/* Testing with inexistent column */ 29var_dump(pg_select($conn, 'phptests.bar', array('id' => 1))); 30 31/* Existent column */ 32var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4))); 33 34 35pg_query('DROP TABLE phptests.foo'); 36pg_query('DROP TABLE phptests.bar'); 37pg_query('DROP SCHEMA phptests'); 38 39?> 40--EXPECTF-- 41Warning: pg_select(): Table 'foo' doesn't exists in %s on line %d 42bool(false) 43array(1) { 44 [0]=> 45 array(2) { 46 ["id"]=> 47 string(1) "1" 48 ["id2"]=> 49 string(1) "2" 50 } 51} 52 53Notice: pg_select(): Invalid field name (id) in values in %s on line %d 54bool(false) 55array(1) { 56 [0]=> 57 array(2) { 58 ["id4"]=> 59 string(1) "4" 60 ["id3"]=> 61 string(1) "5" 62 } 63} 64