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