Skip to content

Commit 1753f3a

Browse files
committed
fix: Is Alive
1 parent e4180b0 commit 1753f3a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

WebFiori/Database/MySql/MySQLConnection.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,15 @@ public function close(): void {
8282
* @return bool True if the connection is active.
8383
*/
8484
public function isAlive(): bool {
85-
return $this->link !== null && @$this->link->ping();
85+
if ($this->link === null) {
86+
return false;
87+
}
88+
89+
try {
90+
return @$this->link->query('SELECT 1') !== false;
91+
} catch (\Exception $e) {
92+
return false;
93+
}
8694
}
8795

8896
public function beginTransaction(?string $name = null) {

0 commit comments

Comments
 (0)