Annotation of embedaddon/php/ext/pgsql/tests/pg_update_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: PostgreSQL pg_update() - 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 foo (id INT, id2 INT)');
! 15: pg_query('CREATE TABLE phptests.foo (id INT, id2 INT)');
! 16:
! 17:
! 18: pg_insert($conn, 'foo', array('id' => 1, 'id2' => 1));
! 19: pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2));
! 20:
! 21: pg_update($conn, 'foo', array('id' => 10), array('id' => 1));
! 22: var_dump(pg_update($conn, 'foo', array('id' => 10), array('id' => 1), PGSQL_DML_STRING));
! 23:
! 24: pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2));
! 25: var_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');
! 28: while ($row = pg_fetch_assoc($rs)) {
! 29: var_dump($row);
! 30: }
! 31:
! 32: pg_query('DROP TABLE foo');
! 33: pg_query('DROP TABLE phptests.foo');
! 34: pg_query('DROP SCHEMA phptests');
! 35:
! 36: ?>
! 37: --EXPECT--
! 38: string(32) "UPDATE foo SET id=10 WHERE id=1;"
! 39: string(43) "UPDATE phptests.foo SET id=100 WHERE id2=2;"
! 40: array(2) {
! 41: ["id"]=>
! 42: string(2) "10"
! 43: ["id2"]=>
! 44: string(1) "1"
! 45: }
! 46: array(2) {
! 47: ["id"]=>
! 48: string(3) "100"
! 49: ["id2"]=>
! 50: string(1) "2"
! 51: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>