1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 14:46:36 +02:00

Move connect() to Driver

This commit is contained in:
Jakub Vrana
2025-03-30 07:51:47 +02:00
parent 992561f75e
commit 7ee6f4f7ac
13 changed files with 96 additions and 113 deletions

View File

@@ -30,6 +30,14 @@ abstract class SqlDriver {
public string $enumLength = "'(?:''|[^'\\\\]|\\\\.)*'"; // regular expression for parsing enum lengths
/** @var list<string> */ public array $generated = array(); // allowed types of generated columns
/** Connect to the database
* @return Db|string string for error
*/
static function connect(?string $server, string $username, string $password) {
$connection = new Db;
return ($connection->attach($server, $username, $password) ?: $connection);
}
/** Create object for performing database operations */
function __construct(Db $connection) {
$this->conn = $connection;