xref: /PHP-7.0/ext/pgsql/tests/13pg_select_9.phpt (revision d8aa1302)
1--TEST--
2PostgreSQL pg_select() (9.0+)
3--SKIPIF--
4<?php
5include("skipif.inc");
6skip_server_version('9.0', '<');
7?>
8--FILE--
9<?php
10error_reporting(E_ALL);
11
12include 'config.inc';
13
14$db = pg_connect($conn_str);
15pg_query("SET bytea_output = 'hex'");
16
17$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
18$ids = array('num'=>'1234');
19
20$res = pg_select($db, $table_name, $ids) or print "Error\n";
21var_dump($res);
22echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
23echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n";
24echo "Ok\n";
25
26?>
27--EXPECT--
28array(2) {
29  [0]=>
30  array(3) {
31    ["num"]=>
32    string(4) "1234"
33    ["str"]=>
34    string(3) "AAA"
35    ["bin"]=>
36    string(8) "\x424242"
37  }
38  [1]=>
39  array(3) {
40    ["num"]=>
41    string(4) "1234"
42    ["str"]=>
43    string(3) "AAA"
44    ["bin"]=>
45    string(8) "\x424242"
46  }
47}
48SELECT * FROM "php_pgsql_test" WHERE "num"=1234;
49SELECT * FROM "php_pgsql_test" WHERE "num"='1234';
50Ok