mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
This makes the tests independent of each other and allows them to be run in parallel. Co-authored-by: Gina Peter Banyard <girgias@php.net>
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
--TEST--
|
|
PostgreSQL pg_update() (9.0+)
|
|
--EXTENSIONS--
|
|
pgsql
|
|
--SKIPIF--
|
|
<?php
|
|
include("inc/skipif.inc");
|
|
skip_bytea_not_hex();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
error_reporting(E_ALL);
|
|
|
|
include 'inc/config.inc';
|
|
$table_name = "table_14pg_update_9";
|
|
|
|
$db = pg_connect($conn_str);
|
|
pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)");
|
|
pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)");
|
|
pg_query($db, "INSERT INTO {$table_name} VALUES(1, 'ABC', null)");
|
|
|
|
pg_query($db, "SET standard_conforming_strings = 0");
|
|
|
|
$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
|
|
$ids = array('num'=>'1234');
|
|
|
|
pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n";
|
|
echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
|
|
echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n";
|
|
|
|
echo "Ok\n";
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
include('inc/config.inc');
|
|
$table_name = "table_14pg_update_9";
|
|
|
|
$db = pg_connect($conn_str);
|
|
pg_query($db, "DROP TABLE IF EXISTS {$table_name}");
|
|
?>
|
|
--EXPECT--
|
|
UPDATE "table_14pg_update_9" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234;
|
|
UPDATE "table_14pg_update_9" SET "num"='1234',"str"='ABC',"bin"='XYZ' WHERE "num"='1234';
|
|
Ok
|