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


PHP CI_DB::__construct方法代码示例

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


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

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

示例2: __construct

 /**
  * Class constructor
  *
  * Appends the port number to the hostname, if needed.
  *
  * @param	array	$params
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (!empty($this->port)) {
         $this->hostname .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':') . $this->port;
     }
 }
开发者ID:zky001,项目名称:phpHiveAdmin,代码行数:15,代码来源:mssql_driver.php

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

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

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

 /**
  * Class constructor
  *
  * Validates the DSN string and/or detects the subdriver.
  *
  * @param	array	$params
  * @return	void
  */
 public 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->subdriver = $match[1];
         return;
     } elseif (preg_match('/([^:]+):/', $this->hostname, $match) && count($match) === 2) {
         $this->dsn = $this->hostname;
         $this->hostname = NULL;
         $this->subdriver = $match[1];
         return;
     } elseif (in_array($this->subdriver, array('mssql', 'sybase'), TRUE)) {
         $this->subdriver = 'dblib';
     } elseif ($this->subdriver === '4D') {
         $this->subdriver = '4d';
     } elseif (!in_array($this->subdriver, array('4d', 'cubrid', 'dblib', 'firebird', 'ibm', 'informix', 'mysql', 'oci', 'odbc', 'pgsql', 'sqlite', 'sqlsrv'), TRUE)) {
         log_message('error', 'PDO: Invalid or non-existent subdriver');
         if ($this->db_debug) {
             show_error('Invalid or non-existent PDO subdriver');
         }
     }
     $this->dsn = NULL;
 }
开发者ID:NicolasMontoya,项目名称:SARA,代码行数:33,代码来源:pdo_driver.php

示例7: __construct

 /**
  * Class constructor
  *
  * @param	array	$params
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     // This is only supported as of SQLSRV 3.0
     if ($this->scrollable === NULL) {
         $this->scrollable = defined('SQLSRV_CURSOR_CLIENT_BUFFERED') ? SQLSRV_CURSOR_CLIENT_BUFFERED : FALSE;
     }
 }
开发者ID:darkwebside,项目名称:Sprint,代码行数:14,代码来源:sqlsrv_driver.php

示例8: __construct

 /**
  * Class constructor
  *
  * @param	array	$params
  * @return	void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     // Legacy support for DSN in the hostname field
     if (empty($this->dsn)) {
         $this->dsn = $this->hostname;
     }
 }
开发者ID:BryceHappy,项目名称:Oauth2-SocialAuth-for-CodeIgniter,代码行数:14,代码来源:odbc_driver.php

示例9: __construct

 /**
  * Class constructor
  *
  * @param	array	$params
  * @return	void
  */
 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:ndy40,项目名称:dashwebsvc,代码行数:16,代码来源:odbc_driver.php

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

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

示例12: __construct

 /**
  * Class constructor
  *
  * Validates the DSN string and/or detects the subdriver.
  *
  * @param	array	$params
  * @return	void
  */
 public 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->subdriver = $match[1];
         return;
     } elseif (in_array($this->subdriver, array('mssql', 'sybase'), TRUE)) {
         $this->subdriver = 'dblib';
     } elseif ($this->subdriver === '4D') {
         $this->subdriver = '4d';
     }
     $this->dsn = NULL;
 }
开发者ID:madwings,项目名称:insanedb,代码行数:23,代码来源:pdo_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: __construct

 /**
  * Class constructor
  *
  * Creates a DSN string to be used for db_connect() and db_pconnect()
  *
  * @param array $params        	
  * @return void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (!empty($this->dsn)) {
         return;
     }
     $this->dsn === '' or $this->dsn = '';
     if (strpos($this->hostname, '/') !== FALSE) {
         // If UNIX sockets are used, we shouldn't set a port
         $this->port = '';
     }
     $this->hostname === '' or $this->dsn = 'host=' . $this->hostname . ' ';
     if (!empty($this->port) && ctype_digit($this->port)) {
         $this->dsn .= 'port=' . $this->port . ' ';
     }
     if ($this->username !== '') {
         $this->dsn .= 'user=' . $this->username . ' ';
         /*
          * An empty password is valid!
          *
          * $db['password'] = NULL must be done in order to ignore it.
          */
         $this->password === NULL or $this->dsn .= "password='" . $this->password . "' ";
     }
     $this->database === '' or $this->dsn .= 'dbname=' . $this->database . ' ';
     /*
      * We don't have these options as elements in our standard configuration
      * array, but they might be set by parse_url() if the configuration was
      * provided via string. Example:
      *
      * postgre://username:password@localhost:5432/database?connect_timeout=5&sslmode=1
      */
     foreach (array('connect_timeout', 'options', 'sslmode', 'service') as $key) {
         if (isset($this->{$key}) && is_string($this->key) && $this->key !== '') {
             $this->dsn .= $key . "='" . $this->key . "' ";
         }
     }
     $this->dsn = rtrim($this->dsn);
 }
开发者ID:kronus7713,项目名称:web2015,代码行数:47,代码来源:postgre_driver.php

示例15: RND

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


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