当前位置: 首页>>代码示例>>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;未经允许,请勿转载。