コード例 #1
0
ファイル: model.php プロジェクト: obscurun/run-dev
 public static function getInstance($id = false)
 {
     if (!$id) {
         foreach (self::$connectionData as $k => $v) {
             $idC = $k;
             break;
         }
     } else {
         $idC = $id;
     }
     $connection = Model::getConnectionData($idC);
     $database = NULL;
     // Debug::print_r("getInstance $id ", $connection);
     if (Run::MYSQL === true && $connection['type_db'] == "mysql") {
         $database = Mysql::getInstance($id);
         if ($id) {
             Mysql::setActive($id);
         }
         self::$query = new MysqlQuery($id);
         return $database;
     } else {
         if (Run::POSTGRE === true && $connection['type_db'] == "postgre") {
             $database = Postgre::getInstance($id);
             if ($id) {
                 Postgre::setActive($id);
             }
             self::$query = new PostgreQuery($id);
             return $database;
         } else {
             return false;
         }
     }
 }
コード例 #2
0
ファイル: postgre_query.php プロジェクト: obscurun/run-dev
 function PostgreQuery($id)
 {
     $this->query_string = "";
     $this->_line = __LINE__;
     $this->_function = __FUNCTION__;
     $this->_class = __CLASS__;
     $this->_file = __FILE__;
     $this->postgre = Postgre::getInstance($id);
 }
コード例 #3
0
ファイル: postgre.php プロジェクト: obscurun/run-dev
 public static function getInstance($id)
 {
     if (!$id) {
         foreach (Model::getConnectionsData() as $k => $v) {
             if ($v['type_db'] == "postgre") {
                 $id = $k;
                 break;
             }
         }
     }
     Debug::log("getInstance Postgre.", __LINE__, __FUNCTION__, __CLASS__, __FILE__);
     if (!isset(self::$instance) || !is_object(self::$instance)) {
         $class = __CLASS__;
         self::$instance = new $class($id);
     }
     if (!isset(self::$connection[$id])) {
         self::$instance->newConnection($id);
     }
     return self::$instance;
 }