xref: /PHP-8.3/ext/pgsql/tests/80_bug14383.phpt (revision eddab740)
1--TEST--
2Bug #14383 (8.0+) (using postgres with DBA causes DBA not to be able to find any keys)
3--EXTENSIONS--
4dba
5pgsql
6--SKIPIF--
7<?php
8require_once dirname(__DIR__, 2) . '/dba/tests/setup/setup_dba_tests.inc';
9check_skip_any();
10require_once('skipif.inc');
11?>
12--FILE--
13<?php
14require_once('config.inc');
15
16$dbh = @pg_connect($conn_str);
17if (!$dbh) {
18    die ("Could not connect to the server");
19}
20pg_close($dbh);
21
22require_once dirname(__DIR__, 2) . '/dba/tests/setup/setup_dba_tests.inc';
23$name = 'bug14383.db';
24
25$handler = get_any_handler($name);
26run_standard_tests($handler, $name);
27?>
28--CLEAN--
29<?php
30require_once dirname(__DIR__, 2) . '/dba/tests/setup/setup_dba_tests.inc';
31$name = 'bug14383.db';
32cleanup_standard_db($name);
33?>
34--EXPECTF--
35Using handler: "%s"
36=== RUNNING WITH FILE LOCK ===
37Remove key 1 and 3
38bool(true)
39bool(true)
40Try to remove key 1 again
41bool(false)
42key2: Content String 2
43key4: Another Content String
44key5: The last content string
45name9: Content String 9
46[key10]name10: Content String 10
47[key30]name30: Content String 30
48Total keys: 6
49Key 1 exists? N
50Key 2 exists? Y
51Key 3 exists? N
52Key 4 exists? Y
53Key 5 exists? Y
54Replace second key data
55bool(true)
56Content 2 replaced
57Read during write: not allowed
58Expected: Added a new data entry
59Expected: Failed to insert data for already used key
60Replace second key data
61bool(true)
62Delete "key4"
63bool(true)
64Fetch "key2": Content 2 replaced 2nd time
65Fetch "key number 6": The 6th value
66array(6) {
67  ["[key10]name10"]=>
68  string(17) "Content String 10"
69  ["[key30]name30"]=>
70  string(17) "Content String 30"
71  ["key number 6"]=>
72  string(13) "The 6th value"
73  ["key2"]=>
74  string(27) "Content 2 replaced 2nd time"
75  ["key5"]=>
76  string(23) "The last content string"
77  ["name9"]=>
78  string(16) "Content String 9"
79}
80=== RUNNING WITH DB LOCK (default) ===
81SAME OUTPUT AS PREVIOUS RUN
82=== RUNNING WITH NO LOCK ===
83SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock)
84