Пример #1
0
 /**
  * Connect to database
  * @method dbConnect
  * @static
  * @return {boolean}
  */
 static function dbConnect()
 {
     if (isset(self::$db)) {
         return false;
     }
     $driver_options = array('3' => 2);
     $arr = Pie_Config::get('db', 'connections', 'rs', false);
     if (!$arr) {
         throw new Exception("Missing connection details for rs");
     }
     extract($arr);
     self::$db = new PDO($dsn, $username, $password, $driver_options);
     if (!self::$db) {
         throw new Exception("Could not connect to db");
     }
     return true;
 }