getDefaultDb() public static method

getDefaultDb 取得預設的 Db
public static getDefaultDb ( ) : void
return void
Esempio n. 1
0
 /**
  * 取得該 Table 專用的 Pix_Table_Db
  *
  * @return Pix_Table_Db db
  **/
 public static function getDb()
 {
     $table = self::getTable();
     if ($table->_db) {
         return $table->_db;
     }
     if ($db = $table->_getDb() and !is_null($db)) {
         // 來自 _getDb(), 標準用法
     } elseif ($db = Pix_Table::getDefaultDb()) {
         // 預設 Db
     } else {
         throw new Pix_Table_Exception("你必需實作 protected " . $table->getClass() . "::_getDb();");
     }
     $table->_db = Pix_Table_Db::factory($db);
     return $table->_db;
 }