/** * 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); }
/** * SQLite driver connector * * @param string $filename */ public function __construct($filename) { $pdo = new \PDO('sqlite:' . $filename); parent::__construct($pdo); }