当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Db_Adapter_Pdo_Abstract::getConnection方法代码示例

本文整理汇总了PHP中Zend_Db_Adapter_Pdo_Abstract::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Adapter_Pdo_Abstract::getConnection方法的具体用法?PHP Zend_Db_Adapter_Pdo_Abstract::getConnection怎么用?PHP Zend_Db_Adapter_Pdo_Abstract::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Db_Adapter_Pdo_Abstract的用法示例。


在下文中一共展示了Zend_Db_Adapter_Pdo_Abstract::getConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 function tearDown()
 {
     // drop test table
     $this->_db->query($this->getDropTableSQL());
     // close the PDO connection
     $connection = $this->_db->getConnection();
     $connection = null;
     $this->_db = null;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:9,代码来源:Common.php

示例2: _zendConnect

 /**
  * Initialize Zend database adapter
  *
  * @param   string  $dbname     The name of the database to connect with
  *
  * @throws  ConfigurationError  In case the resource type is not a supported PDO driver name
  */
 protected function _zendConnect($dbname)
 {
     if ($this->zendConn !== null) {
         return;
     }
     $config = array('dbname' => $dbname, 'host' => $this->config['host'], 'port' => $this->config['port'], 'username' => $this->config['username'], 'password' => $this->config['password']);
     if ($this->config['db'] === 'mysql') {
         if (isset($this->config['use_ssl']) && $this->config['use_ssl']) {
             $this->config['driver_options'] = array();
             # The presence of these keys as empty strings or null cause non-ssl connections to fail
             if ($this->config['ssl_key']) {
                 $config['driver_options'][PDO::MYSQL_ATTR_SSL_KEY] = $this->config['ssl_key'];
             }
             if ($this->config['ssl_cert']) {
                 $config['driver_options'][PDO::MYSQL_ATTR_SSL_CERT] = $this->config['ssl_cert'];
             }
             if ($this->config['ssl_ca']) {
                 $config['driver_options'][PDO::MYSQL_ATTR_SSL_CA] = $this->config['ssl_ca'];
             }
             if ($this->config['ssl_capath']) {
                 $config['driver_options'][PDO::MYSQL_ATTR_SSL_CAPATH] = $this->config['ssl_capath'];
             }
             if ($this->config['ssl_cipher']) {
                 $config['driver_options'][PDO::MYSQL_ATTR_SSL_CIPHER] = $this->config['ssl_cipher'];
             }
         }
         $this->zendConn = new Zend_Db_Adapter_Pdo_Mysql($config);
     } elseif ($this->config['db'] === 'pgsql') {
         $this->zendConn = new Zend_Db_Adapter_Pdo_Pgsql($config);
     } else {
         throw new ConfigurationError('Failed to connect to database. Unsupported PDO driver "%s"', $this->config['db']);
     }
     $this->zendConn->getConnection();
     // Force connection attempt
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:42,代码来源:DbTool.php

示例3: _zendConnect

 /**
  * Initialize Zend database adapter
  *
  * @param   string  $dbname     The name of the database to connect with
  *
  * @throws  ConfigurationError  In case the resource type is not a supported PDO driver name
  */
 protected function _zendConnect($dbname)
 {
     if ($this->zendConn !== null) {
         return;
     }
     $config = array('dbname' => $dbname, 'host' => $this->config['host'], 'port' => $this->config['port'], 'username' => $this->config['username'], 'password' => $this->config['password']);
     if ($this->config['db'] === 'mysql') {
         $this->zendConn = new Zend_Db_Adapter_Pdo_Mysql($config);
     } elseif ($this->config['db'] === 'pgsql') {
         $this->zendConn = new Zend_Db_Adapter_Pdo_Pgsql($config);
     } else {
         throw new ConfigurationError('Failed to connect to database. Unsupported PDO driver "%s"', $this->config['db']);
     }
     $this->zendConn->getConnection();
     // Force connection attempt
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:23,代码来源:DbTool.php


注:本文中的Zend_Db_Adapter_Pdo_Abstract::getConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。