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


PHP CI_DB_pdo_driver類代碼示例

本文整理匯總了PHP中CI_DB_pdo_driver的典型用法代碼示例。如果您正苦於以下問題:PHP CI_DB_pdo_driver類的具體用法?PHP CI_DB_pdo_driver怎麽用?PHP CI_DB_pdo_driver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: __construct

 /**
  * Constructor
  *
  * Builds the DSN if not already set.
  *
  * @param	array
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (empty($this->dsn)) {
         $this->dsn = 'informix:';
         // Pre-defined DSN
         if (empty($this->hostname) && empty($this->host) && empty($this->port) && empty($this->service)) {
             if (isset($this->DSN)) {
                 $this->dsn .= 'DSN=' . $this->DSN;
             } elseif (!empty($this->database)) {
                 $this->dsn .= 'DSN=' . $this->database;
             }
             return;
         }
         if (isset($this->host)) {
             $this->dsn .= 'host=' . $this->host;
         } else {
             $this->dsn .= 'host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
         }
         if (isset($this->service)) {
             $this->dsn .= '; service=' . $this->service;
         } elseif (!empty($this->port)) {
             $this->dsn .= '; service=' . $this->port;
         }
         empty($this->database) or $this->dsn .= '; database=' . $this->database;
         empty($this->server) or $this->dsn .= '; server=' . $this->server;
         $this->dsn .= '; protocol=' . (isset($this->protocol) ? $this->protocol : 'onsoctcp') . '; EnableScrollableCursors=1';
     }
 }
開發者ID:jemmy655,項目名稱:TomatoCart-v2,代碼行數:37,代碼來源:pdo_informix_driver.php

示例2: __construct

 /**
  * Constructor
  *
  * Builds the DSN if not already set.
  *
  * @param	array
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (empty($this->dsn)) {
         $this->dsn = 'odbc:';
         // Pre-defined DSN
         if (empty($this->hostname) && empty($this->HOSTNAME) && empty($this->port) && empty($this->PORT)) {
             if (isset($this->DSN)) {
                 $this->dsn .= 'DSN=' . $this->DSN;
             } elseif (!empty($this->database)) {
                 $this->dsn .= 'DSN=' . $this->database;
             }
             return;
         }
         // If the DSN is not pre-configured - try to build an IBM DB2 connection string
         $this->dsn .= 'DRIVER=' . (isset($this->DRIVER) ? '{' . $this->DRIVER . '}' : '{IBM DB2 ODBC DRIVER}') . ';';
         if (isset($this->DATABASE)) {
             $this->dsn .= 'DATABASE=' . $this->DATABASE . ';';
         } elseif (!empty($this->database)) {
             $this->dsn .= 'DATABASE=' . $this->database . ';';
         }
         if (isset($this->HOSTNAME)) {
             $this->dsn .= 'HOSTNAME=' . $this->HOSTNAME . ';';
         } else {
             $this->dsn .= 'HOSTNAME=' . (empty($this->hostname) ? '127.0.0.1;' : $this->hostname . ';');
         }
         if (isset($this->PORT)) {
             $this->dsn .= 'PORT=' . $this->port . ';';
         } elseif (!empty($this->port)) {
             $this->dsn .= ';PORT=' . $this->port . ';';
         }
         $this->dsn .= 'PROTOCOL=' . (isset($this->PROTOCOL) ? $this->PROTOCOL . ';' : 'TCPIP;');
     }
 }
開發者ID:colonia,項目名稱:tomatocart-v2,代碼行數:42,代碼來源:pdo_odbc_driver.php

示例3: __construct

 /**
  * Constructor
  *
  * Builds the DSN if not already set.
  *
  * @param	array
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (empty($this->dsn)) {
         $this->dsn = 'pgsql:host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
         empty($this->port) or $this->dsn .= ';port=' . $this->port;
         empty($this->database) or $this->dsn .= ';dbname=' . $this->database;
     }
 }
開發者ID:jemmy655,項目名稱:TomatoCart-v2,代碼行數:17,代碼來源:pdo_pgsql_driver.php

示例4: __construct

 /**
  * Constructor
  *
  * Builds the DSN if not already set.
  *
  * @param	array
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (empty($this->dsn)) {
         $this->dsn = '4D:host=' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname);
         empty($this->port) or $this->dsn .= ';port=' . $this->port;
         empty($this->database) or $this->dsn .= ';dbname=' . $this->database;
         empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
     } elseif (!empty($this->char_set) && strpos($this->dsn, 'charset=', 3) === FALSE) {
         $this->dsn .= ';charset=' . $this->char_set;
     }
 }
開發者ID:jemmy655,項目名稱:TomatoCart-v2,代碼行數:20,代碼來源:pdo_4d_driver.php

示例5: 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

示例6: 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

示例7: __construct

 /**
  * Constructor
  *
  * Builds the DSN if not already set.
  *
  * @param	array
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (empty($this->dsn)) {
         $this->dsn = 'firebird:';
         if (!empty($this->database)) {
             $this->dsn .= 'dbname=' . $this->database;
         } elseif (!empty($this->hostname)) {
             $this->dsn .= 'dbname=' . $this->hostname;
         }
         empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
         empty($this->role) or $this->dsn .= ';role=' . $this->role;
     } elseif (!empty($this->char_set) && strpos($this->dsn, 'charset=', 9) === FALSE) {
         $this->dsn .= ';charset=' . $this->char_set;
     }
 }
開發者ID:rishikeshwalawalkar,項目名稱:GetARide,代碼行數:24,代碼來源:pdo_firebird_driver.php

示例8: __construct

 /**
  * Constructor
  *
  * Builds the DSN if not already set.
  *
  * @param	array
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (empty($this->dsn)) {
         $this->dsn = 'oci:dbname=';
         // Oracle has a slightly different PDO DSN format (Easy Connect),
         // which also supports pre-defined DSNs.
         if (empty($this->hostname) && empty($this->port)) {
             $this->dsn .= $this->database;
         } else {
             $this->dsn .= '//' . (empty($this->hostname) ? '127.0.0.1' : $this->hostname) . (empty($this->port) ? '' : ':' . $this->port) . '/';
             empty($this->database) or $this->dsn .= $this->database;
         }
         empty($this->char_set) or $this->dsn .= ';charset=' . $this->char_set;
     } elseif (!empty($this->char_set) && strpos($this->dsn, 'charset=', 4) === FALSE) {
         $this->dsn .= ';charset=' . $this->char_set;
     }
 }
開發者ID:jemmy655,項目名稱:TomatoCart-v2,代碼行數:26,代碼來源:pdo_oci_driver.php

示例9: _delete

 /**
  * Delete statement
  *
  * Generates a platform-specific delete string from the supplied data
  *
  * @param	string	$table
  * @return	string
  */
 protected function _delete($table)
 {
     $this->qb_limit = FALSE;
     return parent::_delete($table);
 }
開發者ID:DeDoOozZz,項目名稱:brighterycms,代碼行數:13,代碼來源:pdo_informix_driver.php

示例10: 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

示例11: 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

示例12: _insert_batch

 /**
  * Insert batch statement
  *
  * Generates a platform-specific insert string from the supplied data.
  *
  * @param    string $table Table name
  * @param    array $keys INSERT keys
  * @param    array $values INSERT values
  * @return    string|bool
  */
 protected function _insert_batch($table, $keys, $values)
 {
     // Multiple-value inserts are only supported as of SQL Server 2008
     if (version_compare($this->version(), '10', '>=')) {
         return parent::_insert_batch($table, $keys, $values);
     }
     return $this->db->db_debug ? $this->db->display_error('db_unsupported_feature') : FALSE;
 }
開發者ID:at15,項目名稱:codeignitordb,代碼行數:18,代碼來源:pdo_sqlsrv_driver.php

示例13: _delete

 /**
  * Delete statement
  *
  * Generates a platform-specific delete string from the supplied data
  *
  * @param	string	$table
  * @return	string
  */
 protected function _delete($table)
 {
     if ($this->qb_limit) {
         $this->where('rownum <= ', $this->qb_limit, FALSE);
         $this->qb_limit = FALSE;
     }
     return parent::_delete($table);
 }
開發者ID:segaz2002,項目名稱:Codeigniter,代碼行數:16,代碼來源:pdo_oci_driver.php

示例14: 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

示例15: _replace

 /**
  * Replace statement
  *
  * @param	string	$table	Table name
  * @param	array	$keys	INSERT keys
  * @param	array	$values	INSERT values
  * @return 	string
  */
 protected function _replace($table, $keys, $values)
 {
     return 'INSERT OR ' . parent::_replace($table, $keys, $values);
 }
開發者ID:assad2012,項目名稱:My_CodeIgniter,代碼行數:12,代碼來源:pdo_sqlite_driver.php


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