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


PHP CI_DB_pdo_driver::db_connect方法代码示例

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


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

示例1: db_connect

 /**
  * Non-persistent database connection
  *
  * @param	bool
  * @return	object
  */
 public function db_connect($persistent = FALSE)
 {
     /* Prior to PHP 5.3.6, even if the charset was supplied in the DSN
      * on connect - it was ignored. This is a work-around for the issue.
      *
      * Reference: http://www.php.net/manual/en/ref.pdo-mysql.connection.php
      */
     if (!is_php('5.3.6') && !empty($this->char_set)) {
         $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $this->char_set . (empty($this->dbcollat) ? '' : ' COLLATE ' . $this->dbcollat);
     }
     return parent::db_connect($persistent);
 }
开发者ID:rishikeshwalawalkar,项目名称:GetARide,代码行数:18,代码来源:pdo_mysql_driver.php

示例2: db_connect

 /**
  * Non-persistent database connection
  *
  * @param	bool
  * @return	object
  */
 public function db_connect($persistent = FALSE)
 {
     $this->conn_id = parent::db_connect($persistent);
     if (!is_object($this->conn_id)) {
         return $this->conn_id;
     }
     // Determine how identifiers are escaped
     $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
     $query = $query->row_array();
     $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi'];
     $this->_escape_char = $this->_quoted_identifier ? '"' : array('[', ']');
     return $this->conn_id;
 }
开发者ID:jemmy655,项目名称:TomatoCart-v2,代码行数:19,代码来源:pdo_dblib_driver.php

示例3: db_connect

 /**
  * Database connection
  *
  * @param	bool	$persistent
  * @return	object
  */
 public function db_connect($persistent = FALSE)
 {
     $this->conn_id = parent::db_connect($persistent);
     if (is_object($this->conn_id) && !empty($this->schema)) {
         $this->simple_query('SET search_path TO ' . $this->schema . ',public');
     }
     return $this->conn_id;
 }
开发者ID:acamboy,项目名称:Codeigniter-3.0-with-XHMVC,代码行数:14,代码来源:pdo_pgsql_driver.php

示例4: db_connect

 /**
  * Non-persistent database connection
  *
  * @param	bool
  * @return	object
  */
 public function db_connect($persistent = FALSE)
 {
     if (!empty($this->char_set) && preg_match('/utf[^8]*8/i', $this->char_set)) {
         $this->options[PDO::SQLSRV_ENCODING_UTF8] = 1;
     }
     $this->conn_id = parent::db_connect($persistent);
     if (!is_object($this->conn_id) or is_bool($this->_quoted_identifier)) {
         return $this->conn_id;
     }
     // Determine how identifiers are escaped
     $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
     $query = $query->row_array();
     $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi'];
     $this->_escape_char = $this->_quoted_identifier ? '"' : array('[', ']');
     return $this->conn_id;
 }
开发者ID:rishikeshwalawalkar,项目名称:GetARide,代码行数:22,代码来源:pdo_sqlsrv_driver.php

示例5: db_connect

 /**
  * Database connection
  *
  * @param	bool	$persistent
  * @return	object
  */
 public function db_connect($persistent = FALSE)
 {
     /* Prior to PHP 5.3.6, even if the charset was supplied in the DSN
      * on connect - it was ignored. This is a work-around for the issue.
      *
      * Reference: http://www.php.net/manual/en/ref.pdo-mysql.connection.php
      */
     if (!is_php('5.3.6') && !empty($this->char_set)) {
         $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $this->char_set . (empty($this->dbcollat) ? '' : ' COLLATE ' . $this->dbcollat);
     }
     if ($this->stricton) {
         if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND])) {
             $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode="STRICT_ALL_TABLES"';
         } else {
             $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = "STRICT_ALL_TABLES"';
         }
     }
     if ($this->compress === TRUE) {
         $this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE;
     }
     // SSL support was added to PDO_MYSQL in PHP 5.3.7
     if (is_array($this->encrypt) && is_php('5.3.7')) {
         $ssl = array();
         empty($this->encrypt['ssl_key']) or $ssl[PDO::MYSQL_ATTR_SSL_KEY] = $this->encrypt['ssl_key'];
         empty($this->encrypt['ssl_cert']) or $ssl[PDO::MYSQL_ATTR_SSL_CERT] = $this->encrypt['ssl_cert'];
         empty($this->encrypt['ssl_ca']) or $ssl[PDO::MYSQL_ATTR_SSL_CA] = $this->encrypt['ssl_ca'];
         empty($this->encrypt['ssl_capath']) or $ssl[PDO::MYSQL_ATTR_SSL_CAPATH] = $this->encrypt['ssl_capath'];
         empty($this->encrypt['ssl_cipher']) or $ssl[PDO::MYSQL_ATTR_SSL_CIPHER] = $this->encrypt['ssl_cipher'];
         // DO NOT use array_merge() here!
         // It re-indexes numeric keys and the PDO_MYSQL_ATTR_SSL_* constants are integers.
         empty($ssl) or $this->options += $ssl;
     }
     // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails
     if (($pdo = parent::db_connect($persistent)) !== FALSE && !empty($ssl) && version_compare($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION), '5.7.3', '<=') && empty($pdo->query("SHOW STATUS LIKE 'ssl_cipher'")->fetchObject()->Value)) {
         $message = 'PDO_MYSQL was configured for an SSL connection, but got an unencrypted connection instead!';
         log_message('error', $message);
         return $this->db->db_debug ? $this->db->display_error($message, '', TRUE) : FALSE;
     }
     return $pdo;
 }
开发者ID:hagar72,项目名称:topics,代码行数:46,代码来源:pdo_mysql_driver.php

示例6: db_connect

 /**
  * Database connection.
  *
  * @param bool $persistent
  *
  * @return object
  */
 public function db_connect($persistent = false)
 {
     if ($persistent === true) {
         log_message('debug', "dblib driver doesn't support persistent connections");
     }
     $this->conn_id = parent::db_connect(false);
     if (!is_object($this->conn_id)) {
         return $this->conn_id;
     }
     // Determine how identifiers are escaped
     $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
     $query = $query->row_array();
     $this->_quoted_identifier = empty($query) ? false : (bool) $query['qi'];
     $this->_escape_char = $this->_quoted_identifier ? '"' : ['[', ']'];
     return $this->conn_id;
 }
开发者ID:recca0120,项目名称:laraigniter,代码行数:23,代码来源:pdo_dblib_driver.php

示例7: db_connect

 /**
  * Database connection
  *
  * @param	bool	$persistent
  * @return	object
  * @todo	SSL support
  */
 public function db_connect($persistent = FALSE)
 {
     /* Prior to PHP 5.3.6, even if the charset was supplied in the DSN
      * on connect - it was ignored. This is a work-around for the issue.
      *
      * Reference: http://www.php.net/manual/en/ref.pdo-mysql.connection.php
      */
     if (!is_php('5.3.6') && !empty($this->char_set)) {
         $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $this->char_set . (empty($this->dbcollat) ? '' : ' COLLATE ' . $this->dbcollat);
     }
     if ($this->stricton) {
         if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND])) {
             $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode="STRICT_ALL_TABLES"';
         } else {
             $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = "STRICT_ALL_TABLES"';
         }
     }
     if ($this->compress === TRUE) {
         $this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE;
     }
     return parent::db_connect($persistent);
 }
开发者ID:hyrmedia,项目名称:builderengine,代码行数:29,代码来源:pdo_mysql_driver.php

示例8: db_connect

 /**
  * Database connection
  *
  * @param	bool	$persistent
  * @return	object
  */
 public function db_connect($persistent = FALSE)
 {
     if (isset($this->stricton)) {
         if ($this->stricton) {
             $sql = 'CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")';
         } else {
             $sql = 'REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
                                     @@sql_mode,
                                     "STRICT_ALL_TABLES,", ""),
                                     ",STRICT_ALL_TABLES", ""),
                                     "STRICT_ALL_TABLES", ""),
                                     "STRICT_TRANS_TABLES,", ""),
                                     ",STRICT_TRANS_TABLES", ""),
                                     "STRICT_TRANS_TABLES", "")';
         }
         if (!empty($sql)) {
             if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND])) {
                 $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode = ' . $sql;
             } else {
                 $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = ' . $sql;
             }
         }
     }
     return parent::db_connect($persistent);
 }
开发者ID:madwings,项目名称:insanedb,代码行数:31,代码来源:pdo_mysql_driver.php

示例9: db_connect

 /**
  * Database connection
  *
  * @param	bool	$persistent
  * @return	object
  */
 public function db_connect($persistent = FALSE)
 {
     if (isset($this->stricton)) {
         if ($this->stricton) {
             $sql = 'CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")';
         } else {
             $sql = 'REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
                                     @@sql_mode,
                                     "STRICT_ALL_TABLES,", ""),
                                     ",STRICT_ALL_TABLES", ""),
                                     "STRICT_ALL_TABLES", ""),
                                     "STRICT_TRANS_TABLES,", ""),
                                     ",STRICT_TRANS_TABLES", ""),
                                     "STRICT_TRANS_TABLES", "")';
         }
         if (!empty($sql)) {
             if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND])) {
                 $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode = ' . $sql;
             } else {
                 $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = ' . $sql;
             }
         }
     }
     if ($this->compress === TRUE) {
         $this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE;
     }
     if (is_array($this->encrypt)) {
         $ssl = array();
         empty($this->encrypt['ssl_key']) or $ssl[PDO::MYSQL_ATTR_SSL_KEY] = $this->encrypt['ssl_key'];
         empty($this->encrypt['ssl_cert']) or $ssl[PDO::MYSQL_ATTR_SSL_CERT] = $this->encrypt['ssl_cert'];
         empty($this->encrypt['ssl_ca']) or $ssl[PDO::MYSQL_ATTR_SSL_CA] = $this->encrypt['ssl_ca'];
         empty($this->encrypt['ssl_capath']) or $ssl[PDO::MYSQL_ATTR_SSL_CAPATH] = $this->encrypt['ssl_capath'];
         empty($this->encrypt['ssl_cipher']) or $ssl[PDO::MYSQL_ATTR_SSL_CIPHER] = $this->encrypt['ssl_cipher'];
         // DO NOT use array_merge() here!
         // It re-indexes numeric keys and the PDO_MYSQL_ATTR_SSL_* constants are integers.
         empty($ssl) or $this->options += $ssl;
     }
     // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails
     if (($pdo = parent::db_connect($persistent)) !== FALSE && !empty($ssl) && version_compare($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION), '5.7.3', '<=') && empty($pdo->query("SHOW STATUS LIKE 'ssl_cipher'")->fetchObject()->Value)) {
         $message = 'PDO_MYSQL was configured for an SSL connection, but got an unencrypted connection instead!';
         log_message('error', $message);
         return $this->db->db_debug ? $this->db->display_error($message, '', TRUE) : FALSE;
     }
     return $pdo;
 }
开发者ID:mnapier,项目名称:opensourcepos,代码行数:51,代码来源:pdo_mysql_driver.php


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