Annotation of embedaddon/php/ext/pgsql/tests/pg_select_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PostgreSQL pg_select() - basic test using schema
3: --SKIPIF--
4: <?php include("skipif.inc"); ?>
5: --FILE--
6: <?php
7:
8: include('config.inc');
9:
10: $conn = pg_connect($conn_str);
11:
12: pg_query('CREATE SCHEMA phptests');
13:
14: pg_query('CREATE TABLE phptests.foo (id INT, id2 INT)');
15: pg_query('INSERT INTO phptests.foo VALUES (1,2)');
16: pg_query('INSERT INTO phptests.foo VALUES (2,3)');
17:
18: pg_query('CREATE TABLE phptests.bar (id4 INT, id3 INT)');
19: pg_query('INSERT INTO phptests.bar VALUES (4,5)');
20: pg_query('INSERT INTO phptests.bar VALUES (6,7)');
21:
22: /* Inexistent table */
23: var_dump(pg_select($conn, 'foo', array('id' => 1)));
24:
25: /* Existent column */
26: var_dump(pg_select($conn, 'phptests.foo', array('id' => 1)));
27:
28: /* Testing with inexistent column */
29: var_dump(pg_select($conn, 'phptests.bar', array('id' => 1)));
30:
31: /* Existent column */
32: var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4)));
33:
34:
35: pg_query('DROP TABLE phptests.foo');
36: pg_query('DROP TABLE phptests.bar');
37: pg_query('DROP SCHEMA phptests');
38:
39: ?>
40: --EXPECTF--
41: Warning: pg_select(): Table 'foo' doesn't exists in %s on line %d
42: bool(false)
43: array(1) {
44: [0]=>
45: array(2) {
46: ["id"]=>
47: string(1) "1"
48: ["id2"]=>
49: string(1) "2"
50: }
51: }
52:
53: Notice: pg_select(): Invalid field name (id) in values in %s on line %d
54: bool(false)
55: array(1) {
56: [0]=>
57: array(2) {
58: ["id4"]=>
59: string(1) "4"
60: ["id3"]=>
61: string(1) "5"
62: }
63: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>