Exemple #1
0
 /**
  * Constructeur
  *
  * @param array $auth
  * @return \sJo\Db\PDO\Drivers\Sqlite
  */
 public function __construct(array $auth)
 {
     try {
         parent::__construct('sqlite:' . $auth[0]);
         $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC);
         $this->setAttribute(self::ATTR_ERRMODE, self::ERRMODE_EXCEPTION);
     } catch (\PDOException $e) {
         die('ERROR: ' . $e->getMessage());
     }
 }
Exemple #2
0
 /**
  * Constructeur
  *
  * @param array $auth
  * @return \sJo\Db\PDO\Drivers\Mysql
  */
 public function __construct(array $auth)
 {
     $auth = Lib\Arr::extend(array('host' => 'localhost', 'charset' => 'utf8'), $auth);
     try {
         parent::__construct('mysql:host=' . $auth['host'] . ';dbname=' . $auth['dbname'] . ';charset=' . $auth['charset'], $auth['login'], $auth['password']);
         $this->setAttribute(self::ATTR_ERRMODE, self::ERRMODE_EXCEPTION);
     } catch (\PDOException $e) {
         die('ERROR: ' . $e->getMessage());
     }
 }