xref: /PHP-7.2/ext/pgsql/tests/pg_insert_001.phpt (revision f1d7e3ca)
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--
29Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d
30string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);"
31array(1) {
32  [0]=>
33  array(2) {
34    ["id"]=>
35    string(1) "1"
36    ["id2"]=>
37    string(1) "2"
38  }
39}
40