xref: /PHP-5.6/ext/pgsql/tests/pg_insert_001.phpt (revision f718684a)
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');
13pg_query('CREATE TABLE phptests.foo (id INT, id2 INT)');
14
15
16pg_insert($conn, 'foo', array('id' => 1, 'id2' => 1));
17
18pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2));
19
20var_dump(pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING));
21
22var_dump(pg_select($conn, 'phptests.foo', array('id' => 1)));
23
24pg_query('DROP TABLE phptests.foo');
25pg_query('DROP SCHEMA phptests');
26
27?>
28--EXPECTF--
29
30Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d
31string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);"
32array(1) {
33  [0]=>
34  array(2) {
35    ["id"]=>
36    string(1) "1"
37    ["id2"]=>
38    string(1) "2"
39  }
40}
41