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

PHP CI_DB_pdo_driver类代码示例

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

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



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


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


示例17: version

 /**
  * Database version number
  *
  * @return    string
  */
 public function version()
 {
     if (isset($this->data_cache['version'])) {
         return $this->data_cache['version'];
     }
     $version_string = parent::version();
     if (preg_match('#Release\\s(?<version>\\d+(?:\\.\\d+)+)#', $version_string, $match)) {
         return $this->data_cache['version'] = $match[1];
     }
     return FALSE;
 }
开发者ID:jimok82,项目名称:CIOpenReview,代码行数:16,代码来源:pdo_oci_driver.php


示例18: _delete

 /**
  * Delete statement
  *
  * Generates a platform-specific delete string from the supplied data
  *
  * @param	string	the table name
  * @return	string
  */
 protected function _delete($table)
 {
     if ($this->qb_limit) {
         return 'WITH ci_delete AS (SELECT TOP ' . $this->qb_limit . ' * FROM ' . $table . $this->_compile_wh('qb_where') . ') DELETE FROM ci_delete';
     }
     return parent::_delete($table);
 }
开发者ID:aeduc,项目名称:mideteed,代码行数:15,代码来源:pdo_dblib_driver.php


示例19: is_write_type

 /**
  * Determines if a query is a "write" type.
  *
  * @param	string	An SQL query string
  * @return	bool
  */
 public function is_write_type($sql)
 {
     if (preg_match('#^(INSERT|UPDATE).*RETURNING\\s.+(\\,\\s?.+)*$#i', $sql)) {
         return FALSE;
     }
     return parent::is_write_type($sql);
 }
开发者ID:ssuni,项目名称:myapp,代码行数:13,代码来源:pdo_odbc_driver.php


示例20: __construct

 /**
  * Class constructor
  *
  * Builds the DSN if not already set.
  *
  * @param	array	$params
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     $this->_build_dsn();
 }
开发者ID:madwings,项目名称:insanedb,代码行数:13,代码来源:pdo_cubrid_driver.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP CI_DB_pdo_forge类代码示例发布时间:2022-05-23
下一篇:
PHP CI_DB_forge类代码示例发布时间: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