Status + More dependencies
This commit is contained in:
@@ -300,4 +300,7 @@ class MySQL extends SQL {
|
||||
return new Keyword("NOW()");
|
||||
}
|
||||
|
||||
public function getStatus() {
|
||||
return mysqli_stat($this->connection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,4 +290,15 @@ class PostgreSQL extends SQL {
|
||||
public function currentTimestamp() {
|
||||
return new Keyword("CURRENT_TIMESTAMP");
|
||||
}
|
||||
|
||||
public function getStatus() {
|
||||
$version = pg_version($this->connection)["client"] ?? "??";
|
||||
$status = pg_connection_status($this->connection);
|
||||
static $statusTexts = array(
|
||||
PGSQL_CONNECTION_OK => "PGSQL_CONNECTION_OK",
|
||||
PGSQL_CONNECTION_BAD => "PGSQL_CONNECTION_BAD",
|
||||
);
|
||||
|
||||
return ($statusTexts[$status] ?? "Unknown") . " (v$version)";
|
||||
}
|
||||
}
|
||||
@@ -369,4 +369,6 @@ abstract class SQL {
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public abstract function getStatus();
|
||||
}
|
||||
Reference in New Issue
Block a user