File size: 957 Bytes
1e94262 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | --TEST--
PDO_Firebird: persistent connect test
--EXTENSIONS--
pdo_firebird
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
<?php
/**
* Omit the case where the connection is broken when it checks liveness and
* it has to reconnect, as it is very difficult to reproduce the situation.
*/
require("testdb.inc");
unset($dbh);
$connIds = [];
foreach (['First', 'Second'] as $times) {
$dbh = new PDO(
PDO_FIREBIRD_TEST_DSN,
PDO_FIREBIRD_TEST_USER,
PDO_FIREBIRD_TEST_PASS,
[
PDO::ATTR_PERSISTENT => true,
],
);
$stmt = $dbh->query('SELECT CURRENT_CONNECTION FROM RDB$DATABASE');
$connId = $stmt->fetchColumn();
$connIds[] = $connId;
echo "{$times} connection ID: {$connId}\n";
unset($dbh);
unset($stmt);
unset($connID);
}
echo $connIds[0] === $connIds[1] ? "Same ID.\n" : "Different ID\n";
?>
--EXPECTF--
First connection ID: %d
Second connection ID: %d
Same ID.
|