Пример #1
0
 /**
  * MySQL driver constructor
  *
  * @param string $dbname
  * @param array $settings
  */
 public function __construct($dbname, array $settings = [])
 {
     // default settings
     $settings += ['host' => 'localhost', 'username' => 'root', 'password' => null, 'prefix' => null];
     // create pdo instance
     $connector = 'mysql:host=' . $settings['host'] . ';dbname=' . $dbname;
     $pdo = new \PDO($connector, $settings['username'], $settings['password']);
     parent::__construct($pdo);
 }
Пример #2
0
 /**
  * SQLite driver connector
  *
  * @param string $filename
  */
 public function __construct($filename)
 {
     $pdo = new \PDO('sqlite:' . $filename);
     parent::__construct($pdo);
 }