コード例 #1
0
ファイル: Db.php プロジェクト: uwitec/outbuying
 /**
  * 获得 Watt_Db 对象
  *
  * @example 
  * //in tpm
  * $db = Watt_Db::getDb("propel");
  * 
  * //stand alone
  * $db_cfg['hostspec'] = '10.0.0.15';
  * $db_cfg['port'] = '3306';
  * $db_cfg['username'] = '******';
  * $db_cfg['password'] = '******';
  * $db_cfg['database'] = 'DEV_tpm_watt';
  * $db_cfg['charset'] = 'utf8';
  * $db = Watt_Db::getDb($db_cfg);
  * 
  * @return Watt_Db
  */
 public static function getDb($con_name = "propel")
 {
     if (!self::$_db) {
         self::$_db = new Watt_Db($con_name);
     } else {
         self::$_db->reconnect($con_name);
     }
     return self::$_db;
 }