25 lines
794 B
PHP
25 lines
794 B
PHP
|
<?php
|
||
|
use Database\Database;
|
||
|
|
||
|
final class DB {
|
||
|
private static $instance;
|
||
|
|
||
|
public const ATTRS = [
|
||
|
PDO::ATTR_CASE => PDO::CASE_NATURAL,
|
||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||
|
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
||
|
PDO::ATTR_STRINGIFY_FETCHES => false,
|
||
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||
|
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET SESSION time_zone = \'+00:00\''
|
||
|
. ', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\'',
|
||
|
];
|
||
|
|
||
|
public static function init(...$args) {
|
||
|
self::$instance = new Database(...$args);
|
||
|
}
|
||
|
|
||
|
public static function __callStatic(string $name, array $args) {
|
||
|
return self::$instance->{$name}(...$args);
|
||
|
}
|
||
|
}
|