當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::getDSN方法代碼示例

本文整理匯總了PHP中Connection::getDSN方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::getDSN方法的具體用法?PHP Connection::getDSN怎麽用?PHP Connection::getDSN使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Connection的用法示例。


在下文中一共展示了Connection::getDSN方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: reconnect

 /**
  * 重新連接一次數據庫
  * 如果 $con_name 相同則不連接
  *
  * @param string|array $con_name
  * @param string $forceReconnect
  */
 public function reconnect($con_name, $forceReconnect = false)
 {
     if (is_array($con_name)) {
         $cfg = $con_name;
     } else {
         $cfg = null;
     }
     if ($forceReconnect || $con_name != $this->getConnName()) {
         if ($this->_debug) {
             Watt_Debug::addInfoToDefault("Watt", "Before connect use Watt_Db.");
         }
         if (class_exists('Propel')) {
             $this->_connection = Propel::getConnection($con_name);
             $this->_conn = $this->_connection->getResource();
             $this->_dsn = $this->_connection->getDSN();
         } else {
             if (!is_array($cfg)) {
                 $configuration = (include Watt_Config::getConfigPath() . "propel.conf.php");
                 $cfg = $configuration['datasources'][$con_name]['connection'];
             }
             $this->_conn = mysql_connect($cfg["hostspec"] . ($cfg["port"] ? ":" . $cfg["port"] : ""), $cfg["username"], $cfg["password"]);
             $this->_dsn = $cfg;
             mysql_select_db($cfg["database"], $this->_conn);
             $charset = @$cfg["charset"] ? $cfg["charset"] : 'utf8';
             mysql_query("set names '{$charset}'");
         }
         $this->setConnName($con_name);
         if ($this->_debug) {
             Watt_Debug::addInfoToDefault("Watt", "After connect [{$con_name}] use Watt_Db.");
         }
     }
 }
開發者ID:uwitec,項目名稱:outbuying,代碼行數:39,代碼來源:Db.php

示例2: __construct

 /**
  * @param Connection $dbh
  */
 public function __construct(Connection $conn)
 {
     $this->conn = $conn;
     $this->dblink = $conn->getResource();
     $dsn = $conn->getDSN();
     $this->dbname = $dsn['database'];
 }
開發者ID:BackupTheBerlios,項目名稱:nodin-svn,代碼行數:10,代碼來源:DatabaseInfo.php

示例3: __construct

 /**
  * @param Connection $dbh
  */
 public function __construct(Connection $conn, $vendorInfo = array())
 {
     $this->conn = $conn;
     $this->dblink = $conn->getResource();
     $dsn = $conn->getDSN();
     $this->dbname = $dsn['database'];
     $this->vendorSpecificInfo = $vendorInfo;
 }
開發者ID:saiber,項目名稱:www,代碼行數:11,代碼來源:DatabaseInfo.php

示例4: reconnect_old

 /**
  * 重新連接一次數據庫
  * 如果 $con_name 相同則不連接
  *
  * @param string $con_name
  * @param string $forceReconnect
  */
 public function reconnect_old($con_name, $forceReconnect = false)
 {
     if ($forceReconnect || $con_name != $this->getConnName()) {
         if ($this->_debug) {
             Pft_Debug::addInfoToDefault("Pft", "Before connect use Pft_Db.");
         }
         $this->_connection = Propel::getConnection($con_name);
         $this->_conn = $this->_connection->getResource();
         $this->_dsn = $this->_connection->getDSN();
         /*	
         			$configuration = include( Pft_Config::getConfigPath()."propel.conf.php" );
         			$cfg = $configuration['datasources'][$con_name]['connection'];
         			$this->_conn = mysql_connect($cfg["hostspec"].($cfg["port"]?":".$cfg["port"]:""), $cfg["username"], $cfg["password"]);
         			mysql_select_db( $cfg["database"], $this->_conn );
         */
         $this->setConnName($con_name);
         if ($this->_debug) {
             Pft_Debug::addInfoToDefault("Pft", "After connect [{$con_name}] use Pft_Db.");
         }
     }
 }
開發者ID:uwitec,項目名稱:outbuying,代碼行數:28,代碼來源:Db.php

示例5: getDSN

 /**
  * @see Connection::connect()
  */
 public function getDSN()
 {
     return $this->childConnection->getDSN();
 }
開發者ID:rodrigoprestesmachado,項目名稱:whiteboard,代碼行數:7,代碼來源:DebugConnection.php

示例6: getDSN

 /**
  * @see Connection::connect()
  */
 public function getDSN()
 {
     krumo('DBArrayConnection getDSN ');
     die;
     return $this->childConnection->getDSN();
 }
開發者ID:emildev35,項目名稱:processmaker,代碼行數:9,代碼來源:DBArrayConnection.php


注:本文中的Connection::getDSN方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。