-
Notifications
You must be signed in to change notification settings - Fork 0
API DatabaseManager
Christophe SAUVEUR edited this page Apr 21, 2024
·
2 revisions
final class DatabaseManager extends chsxf\PDO\DatabaseManager
Database manager class
Since 1.0
public const DEFAULT_CONNECTION = '__default';
public function __construct(string $dsn, string $username, string $password, string $server = 'self::DEFAULT_CONNECTION')
Constructor
See \PDO::__construct()
Since 1.0
Name | Type | Description |
---|---|---|
$dsn |
string |
Data Source Name (ie mysql:host=localhost;dbname=mydb) |
$username |
string |
Username |
$password |
string |
Password |
$server |
string |
Server configuration key |
public static function close(DatabaseManager &$_manager)
Since 1.0
Name | Type | Description |
---|---|---|
$_manager |
DatabaseManager |
public static function open(string $server = 'self::DEFAULT_CONNECTION', bool $forceNew = false): DatabaseManager
Opens a connection to a database server, or returns the currently active connection to this server
Since 1.0
Name | Type | Description |
---|---|---|
$server |
string |
Server configuration key (Defaults to __default). |
$forceNew |
bool |
If set, a new connection is open even if a previous similar one exists in the cache (Defaults to false) |
DatabaseManager
Exception | Reason |
---|---|
DatabaseManagerException |
If no configuration is available nor valid for this server key |
Getting Started | Framework Reference | API Reference | MFX is released under the MIT license