xref: /PHP-8.4/ext/pgsql/tests/14pg_update.phpt (revision c15988aa)
1--TEST--
2PostgreSQL pg_update()
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php
7include("inc/skipif.inc");
8skip_bytea_not_escape();
9?>
10--FILE--
11<?php
12error_reporting(E_ALL);
13
14include 'inc/config.inc';
15
16$db = pg_connect($conn_str);
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'XYZ' WHERE "num"=1234;
28UPDATE "php_pgsql_test" SET "num='1234',"str='ABC',"bin='XYZ' WHERE "num='1234';
29Ok
30