xref: /PHP-7.0/ext/pgsql/tests/14pg_update_9.phpt (revision 56854511)
1--TEST--
2PostgreSQL pg_update() (9.0+)
3--SKIPIF--
4<?php
5include("skipif.inc");
6skip_bytea_not_hex();
7?>
8--FILE--
9<?php
10error_reporting(E_ALL);
11
12include 'config.inc';
13
14$db = pg_connect($conn_str);
15pg_query($db, "SET standard_conforming_strings = 0");
16
17$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
18$ids = array('num'=>'1234');
19
20pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n";
21echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
22echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n";
23
24echo "Ok\n";
25?>
26--EXPECT--
27UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234;
28UPDATE "php_pgsql_test" SET "num"='1234',"str"='ABC',"bin"='XYZ' WHERE "num"='1234';
29Ok