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


PHP CI_DB類代碼示例

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


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

示例1: CI_DB_oci10_driver

 function CI_DB_oci10_driver($params)
 {
     $this->clean();
     if (defined('SQLT_RSET')) {
         $this->_iCursorType = SQLT_RSET;
     } else {
         $this->_iCursorType = OCI_B_CURSOR;
     }
     if (defined('SQLT_NTY')) {
         $this->_iCollectionType = SQLT_NTY;
     } else {
         $this->_iCollectionType = OCI_B_NTY;
     }
     if (defined('SQLT_CHR')) {
         $this->_iDefaultType = SQLT_CHR;
     } else {
         $this->_iDefaultType = 1;
     }
     parent::CI_DB_driver($params);
 }
開發者ID:rotac,項目名稱:ci_package-abstraction,代碼行數:20,代碼來源:oci10_driver.php

示例2: CI_DB_odbc_driver

 function CI_DB_odbc_driver($params)
 {
     parent::CI_DB($params);
     $this->_random_keyword = ' RND(' . time() . ')';
     // database specific random keyword
 }
開發者ID:goudaelalfy,項目名稱:erp,代碼行數:6,代碼來源:odbc_driver.php

示例3: CI_DB_sqlrelay_driver

 /**
  * Constructor
  *
  */
 function CI_DB_sqlrelay_driver($params)
 {
     //    function __construct() {
     $this->clean();
     $this->setIsOracle(false);
     $this->_iPrefetch = 1000;
     if (isset($params['getNullsAsNulls']) && true === $params['getNullsAsNulls']) {
         $this->_bgetNullsAsNulls = true;
     }
     parent::CI_DB_driver($params);
     //$this->setAutoCommitOn();
 }
開發者ID:rotac,項目名稱:ci_package-abstraction,代碼行數:16,代碼來源:sqlrelay_driver.php

示例4: __construct

 public function __construct($params)
 {
     parent::__construct($params);
     if (!empty($this->port)) {
         $this->hostname .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':') . $this->port;
     }
 }
開發者ID:colonia,項目名稱:tomatocart-v2,代碼行數:7,代碼來源:mssql_driver.php

示例5: elseif

 function __construct($params)
 {
     parent::__construct($params);
     // clause and character used for LIKE escape sequences
     if (strpos($this->hostname, 'mysql') !== FALSE) {
         $this->_like_escape_str = '';
         $this->_like_escape_chr = '';
         //Prior to this version, the charset can't be set in the dsn
         if (is_php('5.3.6')) {
             $this->hostname .= ";charset={$this->char_set}";
         }
         //Set the charset with the connection options
         $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
     } elseif (strpos($this->hostname, 'odbc') !== FALSE) {
         $this->_like_escape_str = " {escape '%s'} ";
         $this->_like_escape_chr = '!';
     } else {
         $this->_like_escape_str = " ESCAPE '%s' ";
         $this->_like_escape_chr = '!';
     }
     /**
      * @link http://stackoverflow.com/questions/11054618/codeigniter-pdo-database-driver-not-working
      */
     // empty($this->database) OR $this->hostname .= ';dbname='.$this->database;
     $this->hostname = 'mysql:dbname=' . $this->database . ';host=' . $this->hostname;
     $this->trans_enabled = FALSE;
     $this->_random_keyword = ' RND(' . time() . ')';
     // database specific random keyword
 }
開發者ID:NaszvadiG,項目名稱:Base-CodeIgniter-App,代碼行數:29,代碼來源:pdo_driver.php

示例6: end

 function __construct($params)
 {
     parent::__construct($params);
     if (preg_match('/([^;]+):/', $this->dsn, $match) && count($match) == 2) {
         // If there is a minimum valid dsn string pattern found, we're done
         // This is for general PDO users, who tend to have a full DSN string.
         $this->pdodriver = end($match);
     } else {
         // Try to build a complete DSN string from params
         $this->_connect_string($params);
     }
     // clause and character used for LIKE escape sequences
     // this one depends on the driver being used
     if ($this->pdodriver == 'mysql') {
         $this->_like_escape_str = '';
         $this->_like_escape_chr = '';
     } elseif ($this->pdodriver == 'odbc') {
         $this->_like_escape_str = " {escape '%s'} ";
         $this->_like_escape_chr = '!';
     } else {
         $this->_like_escape_str = " ESCAPE '%s' ";
         $this->_like_escape_chr = '!';
     }
     $this->trans_enabled = FALSE;
     $this->_random_keyword = ' RND(' . time() . ')';
     // database specific random keyword
 }
開發者ID:rittidate,項目名稱:sbobet-dev,代碼行數:27,代碼來源:pdo_driver.php

示例7: elseif

 function __construct($params)
 {
     parent::__construct($params);
     // clause and character used for LIKE escape sequences
     if (strpos($this->hostname, 'mysql') !== FALSE) {
         $this->_like_escape_str = '';
         $this->_like_escape_chr = '';
         //Prior to this version, the charset can't be set in the dsn
         if (is_php('5.3.6')) {
             $this->hostname .= ";charset={$this->char_set}";
         }
         //Set the charset with the connection options
         $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
     } elseif (strpos($this->hostname, 'odbc') !== FALSE) {
         $this->_like_escape_str = " {escape '%s'} ";
         $this->_like_escape_chr = '!';
     } else {
         $this->_like_escape_str = " ESCAPE '%s' ";
         $this->_like_escape_chr = '!';
     }
     empty($this->database) or $this->hostname .= ';dbname=' . $this->database;
     $this->trans_enabled = FALSE;
     $this->_random_keyword = ' RND(' . time() . ')';
     // database specific random keyword
 }
開發者ID:meelstorm,項目名稱:PohFramework,代碼行數:25,代碼來源:pdo_driver.php

示例8: __construct

 /**
  * Class constructor
  *
  * @param	array	$params
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (!empty($this->port)) {
         $this->hostname .= ':' . $this->port;
     }
 }
開發者ID:heruprambadi,項目名稱:sim_penyuratan,代碼行數:13,代碼來源:mysql_driver.php

示例9: __construct

 public function __construct($params)
 {
     parent::__construct($params);
     $this->_random_keyword = ' RND(' . time() . ')';
     // database specific random keyword
     // Legacy support for DSN in the hostname field
     if (empty($this->dsn)) {
         $this->dsn = $this->hostname;
     }
 }
開發者ID:colonia,項目名稱:tomatocart-v2,代碼行數:10,代碼來源:odbc_driver.php

示例10: SelectWhere

	function SelectWhere($table, $wherefield, $wherevalue) {
		$this->db->where($wherefield, $wherevalue);
		$query = $this->db->get($table);
		$results = array();
		foreach ($query->result() as $row)
		{
			$results[] = (array)$row;
		}
		return $results;
	}
開發者ID:rtraction,項目名稱:Compost,代碼行數:10,代碼來源:PhpCIdb.php

示例11: __construct

 /**
  * Class constructor
  *
  * @param	array	$params
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (preg_match('/^CUBRID:[^:]+(:[0-9][1-9]{0,4})?:[^:]+:[^:]*:[^:]*:(\\?.+)?$/', $this->dsn, $matches)) {
         if (stripos($matches[2], 'autocommit=off') !== FALSE) {
             $this->auto_commit = FALSE;
         }
     } else {
         // If no port is defined by the user, use the default value
         empty($this->port) or $this->port = 33000;
     }
 }
開發者ID:heruprambadi,項目名稱:sim_penyuratan,代碼行數:18,代碼來源:cubrid_driver.php

示例12: __construct

 public function __construct($params)
 {
     parent::__construct($params);
     $valid_dsns = array('tns' => '/^\\(DESCRIPTION=(\\(.+\\)){2,}\\)$/', 'ec' => '/^(\\/\\/)?[a-z0-9.:_-]+(:[1-9][0-9]{0,4})?(\\/[a-z0-9$_]+)?(:[^\\/])?(\\/[a-z0-9$_]+)?$/i', 'in' => '/^[a-z0-9$_]+$/i');
     /* Space characters don't have any effect when actually
      * connecting, but can be a hassle while validating the DSN.
      */
     $this->dsn = str_replace(array("\n", "\r", "\t", ' '), '', $this->dsn);
     if ($this->dsn !== '') {
         foreach ($valid_dsns as $regexp) {
             if (preg_match($regexp, $this->dsn)) {
                 return;
             }
         }
     }
     // Legacy support for TNS in the hostname configuration field
     $this->hostname = str_replace(array("\n", "\r", "\t", ' '), '', $this->hostname);
     if (preg_match($valid_dsns['tns'], $this->hostname)) {
         $this->dsn = $this->hostname;
         return;
     } elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE && (!empty($this->port) && ctype_digit($this->port) or $this->database !== '')) {
         /* If the hostname field isn't empty, doesn't contain
          * ':' and/or '/' and if port and/or database aren't
          * empty, then the hostname field is most likely indeed
          * just a hostname. Therefore we'll try and build an
          * Easy Connect string from these 3 settings, assuming
          * that the database field is a service name.
          */
         $this->dsn = $this->hostname . (!empty($this->port) && ctype_digit($this->port) ? ':' . $this->port : '') . ($this->database !== '' ? '/' . ltrim($this->database, '/') : '');
         if (preg_match($valid_dsns['ec'], $this->dsn)) {
             return;
         }
     }
     /* At this point, we can only try and validate the hostname and
      * database fields separately as DSNs.
      */
     if (preg_match($valid_dsns['ec'], $this->hostname) or preg_match($valid_dsns['in'], $this->hostname)) {
         $this->dsn = $this->hostname;
         return;
     }
     $this->database = str_replace(array("\n", "\r", "\t", ' '), '', $this->database);
     foreach ($valid_dsns as $regexp) {
         if (preg_match($regexp, $this->database)) {
             return;
         }
     }
     /* Well - OK, an empty string should work as well.
      * PHP will try to use environment variables to
      * determine which Oracle instance to connect to.
      */
     $this->dsn = '';
 }
開發者ID:colonia,項目名稱:tomatocart-v2,代碼行數:52,代碼來源:oci8_driver.php

示例13: RND

 function __construct($params)
 {
     parent::__construct($params);
     // clause and character used for LIKE escape sequences
     if (strpos($this->hostname, 'mysql') !== FALSE) {
         $this->_like_escape_str = '';
         $this->_like_escape_chr = '';
     } else {
         if (strpos($this->hostname, 'odbc') !== FALSE) {
             $this->_like_escape_str = " {escape '%s'} ";
             $this->_like_escape_chr = '!';
         } else {
             $this->_like_escape_str = " ESCAPE '%s' ";
             $this->_like_escape_chr = '!';
         }
     }
     $this->hostname = $this->hostname . ";dbname=" . $this->database;
     $this->trans_enabled = FALSE;
     $this->_random_keyword = ' RND(' . time() . ')';
     // database specific random keyword
 }
開發者ID:hack4reno2011,項目名稱:get_instance--,代碼行數:21,代碼來源:pdo_driver.php

示例14: version

 /**
  * Database version number
  *
  * @return	string
  */
 public function version()
 {
     if (isset($this->data_cache['version'])) {
         return $this->data_cache['version'];
     }
     // Not all subdrivers support the getAttribute() method
     try {
         return $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION);
     } catch (PDOException $e) {
         return parent::version();
     }
 }
開發者ID:NicolasMontoya,項目名稱:SARA,代碼行數:17,代碼來源:pdo_driver.php

示例15: _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:alyayazilim,項目名稱:Servis-Takip,代碼行數:18,代碼來源:mssql_driver.php


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