Status + More dependencies

This commit is contained in:
2020-06-19 13:13:13 +02:00
parent c7b8301db1
commit 077fe68914
14 changed files with 753 additions and 16 deletions

View File

@@ -300,4 +300,7 @@ class MySQL extends SQL {
return new Keyword("NOW()");
}
public function getStatus() {
return mysqli_stat($this->connection);
}
}

View File

@@ -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)";
}
}

View File

@@ -369,4 +369,6 @@ abstract class SQL {
return $sql;
}
public abstract function getStatus();
}