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