forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pdo_firebird] Added pdo_firebird_check_liveness handler (php#12757)
- Loading branch information
1 parent
927adfb
commit 5dfb2d9
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--TEST-- | ||
PDO_Firebird: persistent connect test | ||
--EXTENSIONS-- | ||
pdo_firebird | ||
--SKIPIF-- | ||
<?php require('skipif.inc'); ?> | ||
--XLEAK-- | ||
A bug in firebird causes a memory leak when calling `isc_attach_database()`. | ||
See https://github.com/FirebirdSQL/firebird/issues/7849 | ||
--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. |