Beispiel #1
0
 public function create($tableName)
 {
     try {
         $db = Driver_Factory::factory($this->config['dsn']);
     } catch (PDOException $e) {
         // PDO error
         trigger_error($e->getMessage(), E_USER_ERROR);
     } catch (Exception $e) {
         // framework error
         trigger_error($e->getMessage(), E_USER_ERROR);
     }
     return $db;
 }
Beispiel #2
0
 /**
  * Return iterator.
  *
  * @param string $sqlFile
  * @return Laiz_Db_Iterator_View
  */
 public function create($sqlFile)
 {
     try {
         $db = Driver_Factory::factory($this->config['dsn']);
     } catch (PDOException $e) {
         // PDO error
         trigger_error($e->getMessage(), E_USER_ERROR);
     } catch (Exception $e) {
         // framework error
         trigger_error($e->getMessage(), E_USER_ERROR);
     }
     $dao = new View_Pdo($db);
     return new Iterator_View($dao, $sqlFile);
 }
Beispiel #3
0
 public function create($tableName)
 {
     if (!$this->config) {
         trigger_error('Not configured', E_USER_WARNING);
         return;
     }
     try {
         $db = Driver_Factory::factory($this->config['dsn']);
     } catch (PDOException $e) {
         // PDO error
         trigger_error($e->getMessage(), E_USER_ERROR);
     } catch (Exception $e) {
         // framework error
         trigger_error($e->getMessage(), E_USER_ERROR);
     }
     $dao = new Orm_Pdo($db, $tableName);
     $dao->autoCreateConfig($this->config['autoConfig']);
     $dao->setTableConfigs($this->config['configFile']);
     if (!$dao->existsTable() && $dao->existsTable(Inflector::singularize($tableName))) {
         $dao->setTableName(Inflector::singularize($tableName));
         $dao = new Iterator_Orm($dao);
     }
     return $dao;
 }