Пример #1
0
Файл: sql.php Проект: x17x2a/ff
 function __construct($db_prefix, $dsn, $username = "", $password = "", $driver_options = null)
 {
     global $server_dir;
     if (self::$pdo_instance === null) {
         self::$pdo_instance = new PDO($dsn, $username, $password, $driver_options);
     }
     $sql_type = substr($dsn, 0, strpos($dsn, ':'));
     $path = $server_dir . '/core/driver/' . $sql_type . '.php';
     if (!file_exists($path)) {
         throw new ErrorNotFound("Driver " . $sql_type . " not found with path: {$path}");
     }
     include_once $path;
     $this->sql_instance = new $sql_type();
     $this->db_prefix = $db_prefix;
 }