• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CI_DB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了CI_DB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: array

 /**
  * 以資料庫記錄Log
  * 
  * 20140511 注意,資料庫中的log資料表欄位需要新增「action_key」
  * 
  * log資料表的建置SQL如下:
  * 
  * 
  * @param CI_DB $db
  * @param String|Int $action 如果是用string,則會記錄在資料庫的 action_key
  * @param Object $data
  */
 function kals_log($db, $action, $data = array())
 {
     $url = get_referer_url(FALSE);
     $webpage_id = NULL;
     if ($url !== FALSE) {
         /*
                     $CI =& get_instance();
                     if (isset($CI->webpage) == FALSE || is_null($CI->webpage))
            $CI->load->library('kals_resource/Webpage');
                     $webpage_id = $CI->webpage->filter_webpage_id($url);
         */
         $webpage_id = get_context_webpage()->get_id();
     }
     $user_id = NULL;
     $note = NULL;
     if (is_array($data) && (isset($data['user_id']) || isset($data['memo']))) {
         if (isset($data['user_id'])) {
             $user_id = $data['user_id'];
         }
         if (isset($data['memo'])) {
             $note = $data['memo'];
             if (is_array($note) || is_object($note)) {
                 $note = json_encode($note);
             }
             if ($note === '') {
                 $note = NULL;
             }
         }
     } else {
         if (defined("JSON_UNESCAPED_UNICODE")) {
             $note = json_encode($data, JSON_UNESCAPED_UNICODE);
         } else {
             $note = kals_json_encode($data);
         }
     }
     if (is_null($user_id)) {
         $user = get_context_user();
         if (isset($user)) {
             $user_id = $user->get_id();
         }
     }
     $CI =& get_instance();
     $action_key_mapper = $CI->config->item("log.action_key_mapper");
     // 根據action的類型,修改action資料
     $action_id = null;
     $action_key = null;
     if (is_int($action) || strval(intval($action)) === $action) {
         $action_id = $action;
         if (array_key_exists($action_id, $action_key_mapper)) {
             $action_key = $action_key_mapper[$action_id];
         }
     } else {
         $action_key = $action;
     }
     $db->insert('log', array('webpage_id' => $webpage_id, 'user_id' => $user_id, 'user_ip' => get_client_ip(), 'action' => $action_id, 'action_key' => $action_key, 'note' => $note));
 }
开发者ID:119155012,项目名称:kals,代码行数:68,代码来源:web_apps_helper.php


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


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


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


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


示例9: __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


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


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


示例12: __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


示例13: __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


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


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


示例16: _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


示例17: __construct

 public function __construct($params)
 {
     parent::__construct($params);
     $this->_random_keyword = ' RND(' . time() . ')';
     // database specific random keyword
 }
开发者ID:gocanto,项目名称:gocanto-pos,代码行数:6,代码来源:odbc_driver.php


示例18: RND

 function __construct($params)
 {
     parent::__construct($params);
     $this->_random_keyword = ' RND(' . Startup::getRequestTime() . ')';
     // database specific random keyword
 }
开发者ID:KasaiDot,项目名称:XtraUpload,代码行数:6,代码来源:odbc_driver.php


示例19: _replace

 /**
  * Replace statement
  *
  * Generates a platform-specific replace string from the supplied data
  *
  * @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:segaz2002,项目名称:Codeigniter,代码行数:14,代码来源:sqlite_driver.php


示例20: escape

 /**
  * "Smart" Escape String
  *
  * Escapes data based on type
  * Sets boolean and null types
  *
  * @param	string
  * @return	mixed
  */
 public function escape($str)
 {
     if (is_bool($str)) {
         return $str ? 'TRUE' : 'FALSE';
     }
     return parent::escape($str);
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:16,代码来源:postgre_driver.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CI_DB_forge类代码示例发布时间:2022-05-23
下一篇:
PHP CI_Controller类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap