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


PHP oci_pconnect函数代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param string $dsn
  * @param string $username
  * @param string $passwd
  * @param array $options
  * @return void
  */
 public function __construct($dsn, $username = null, $password = null, array $options = array())
 {
     //Parse the DSN
     $parsedDsn = self::parseDsn($dsn, array('charset'));
     //Get SID name
     $sidString = isset($parsedDsn['sid']) ? '(SID = ' . $parsedDsn['sid'] . ')' : '';
     //Create a description to locate the database to connect to
     $description = '(DESCRIPTION =
         (ADDRESS_LIST =
             (ADDRESS = (PROTOCOL = TCP)(HOST = ' . $parsedDsn['hostname'] . ')
             (PORT = ' . $parsedDsn['port'] . '))
         )
         (CONNECT_DATA =
                 ' . $sidString . '
                 (SERVICE_NAME = ' . $parsedDsn['dbname'] . ')
         )
     )';
     //Attempt a connection
     if (isset($options[\PDO::ATTR_PERSISTENT]) && $options[\PDO::ATTR_PERSISTENT]) {
         $this->_dbh = @oci_pconnect($username, $password, $description, $parsedDsn['charset']);
     } else {
         $this->_dbh = @oci_connect($username, $password, $description, $parsedDsn['charset']);
     }
     //Check if connection was successful
     if (!$this->_dbh) {
         $e = oci_error();
         throw new \PDOException($e['message']);
     }
     //Save the options
     $this->_options = $options;
 }
开发者ID:crazycodr,项目名称:pdo-via-oci8,代码行数:40,代码来源:Oci8.php

示例2: connect

 function connect()
 {
     if (0 == $this->Link_ID) {
         if ($this->Debug) {
             printf("<br>Connecting to {$this->Database}%s...<br>\n", $this->Host ? " ({$this->Host})" : "");
         }
         if ($this->share_connections) {
             if (!$this->share_connection_name) {
                 $this->share_connection_name = get_class($this) . "_Link_ID";
             } else {
                 $this->share_connection_name .= "_Link_ID";
             }
             global ${$this->share_connection_name};
             if (${$this->share_connection_name}) {
                 $this->Link_ID = ${$this->share_connection_name};
                 return true;
             }
         }
         if ($this->persistent) {
             $this->Link_ID = oci_pconnect($this->User, $this->Password, $this->Host ? sprintf($this->full_connection_string, $this->Host, $this->Port, $this->Database) : $this->Database, 'AL32UTF8');
         } else {
             $this->Link_ID = oci_connect($this->User, $this->Password, $this->Host ? sprintf($this->full_connection_string, $this->Host, $this->Port, $this->Database) : $this->Database, 'AL32UTF8');
         }
         if (!$this->Link_ID) {
             $this->connect_failed();
             return false;
         }
         if ($this->share_connections) {
             ${$this->share_connection_name} = $this->Link_ID;
         }
         if ($this->Debug) {
             printf("<br>Obtained the Link_ID: {$this->Link_ID}<br>\n");
         }
     }
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:35,代码来源:class.db_oci8.inc.php

示例3: __construct

 /**
  * Class constructor
  *
  * @param string $data     the connection string
  * @param string $username user name
  * @param string $password password
  * @param string $options  options to send to the connection
  *
  * @return \PDO object
  * @throws \PDOException
  */
 public function __construct($data, $username, $password, $options = null)
 {
     if (!function_exists("\\oci_parse")) {
         throw new \PDOException("No support for Oracle, please install the OCI driver");
     }
     // find charset
     $charset = null;
     $data = preg_replace('/^oci:/', '', $data);
     $tokens = preg_split('/;/', $data);
     $data = str_replace(array('dbname=//', 'dbname='), '', $tokens[0]);
     $charset = $this->_getCharset($tokens);
     try {
         if (!is_null($options) && array_key_exists(\PDO::ATTR_PERSISTENT, $options)) {
             $this->_con = \oci_pconnect($username, $password, $data, $charset);
             $this->setError();
         } else {
             $this->_con = \oci_connect($username, $password, $data, $charset);
             $this->setError();
         }
         if (!$this->_con) {
             $error = oci_error();
             throw new \Exception($error['code'] . ': ' . $error['message']);
         }
     } catch (\Exception $exception) {
         throw new \PDOException($exception->getMessage());
     }
     return $this;
 }
开发者ID:taq,项目名称:pdooci,代码行数:39,代码来源:PDO.php

示例4: connection

 public static function connection($dsn_data)
 {
     if (!isset($dsn_data['DB_HOST']) || empty($dsn_data['DB_HOST'])) {
         throw new KurogoConfigurationException("Oracle host not specified");
     }
     if (!isset($dsn_data['DB_USER']) || empty($dsn_data['DB_USER'])) {
         throw new KurogoConfigurationException("Oracle user not specified");
     }
     if (!isset($dsn_data['DB_PASS']) || empty($dsn_data['DB_PASS'])) {
         throw new KurogoConfigurationException("Oracle password not specified");
     }
     if (!isset($dsn_data['DB_DBNAME']) || empty($dsn_data['DB_DBNAME'])) {
         throw new KurogoConfigurationException("Oracle database not specified");
     }
     $connectionString = $dsn_data['DB_HOST'];
     if (isset($dsn_data['DB_PORT']) && !empty($dsn_data['DB_PORT'])) {
         $connectionString .= ':' . $dsn_data['DB_PORT'];
     }
     $connectionString .= '/' . $dsn_data['DB_DBNAME'];
     if (isset($dsn_data['DB_CHARSET']) && !empty($dsn_data['DB_CHARSET'])) {
         $charSet = $dsn_data['DB_CHARSET'];
     } else {
         $charSet = 'utf8';
     }
     $connection = oci_pconnect($dsn_data['DB_USER'], $dsn_data['DB_PASS'], $connectionString, $charSet);
     return $connection;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:27,代码来源:db_oci8.php

示例5: connect

 /**
  * Connect to an Oracle database using a persistent connection
  *
  * New instances of this class will use the same connection across multiple requests.
  *
  * @param string $username
  * @param string $password
  * @param string $connectionString
  * @param string $characterSet
  * @param int $sessionMode
  * @return resource
  * @see http://php.net/manual/en/function.oci-pconnect.php
  */
 protected function connect($username, $password, $connectionString = null, $characterSet = null, $sessionMode = null)
 {
     set_error_handler($this->getErrorHandler());
     $connection = oci_pconnect($username, $password, $connectionString, $characterSet, $sessionMode);
     restore_error_handler();
     return $connection;
 }
开发者ID:jpina,项目名称:oci8,代码行数:20,代码来源:Oci8PersistentConnection.php

示例6: __construct

 /**
  * Class constructor
  *
  * @param                 $data
  * @param                 $username
  * @param                 $password
  * @param array           $options
  * @param AbstractLogger $logger
  * @param CacheInterface   $cache
  */
 public function __construct($data, $username = null, $password = null, $options = [], AbstractLogger $logger = null, CacheInterface $cache = null)
 {
     if (!function_exists("\\oci_parse")) {
         throw new PDOException(PHP_VERSION . " : No support for Oracle, please install the OCI driver");
     }
     // find charset
     $charset = null;
     $data = preg_replace('/^oci:/', '', $data);
     $tokens = preg_split('/;/', $data);
     $data = $tokens[0];
     $charset = $this->_getCharset($tokens);
     try {
         if (!is_null($options) && array_key_exists(\PDO::ATTR_PERSISTENT, $options)) {
             $this->_con = \oci_pconnect($username, $password, $data, $charset);
             $this->setError();
         } else {
             $this->_con = \oci_connect($username, $password, $data, $charset);
             $this->setError();
         }
         if (!$this->_con) {
             $error = oci_error();
             throw new \Exception($error['code'] . ': ' . $error['message']);
         }
     } catch (\Exception $exception) {
         throw new PDOException($exception->getMessage());
     }
     $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $this->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
     $this->setConfig($options, $data);
     $this->setLogger($logger ? $logger : new NullLogger());
     $this->setCache($cache ? $cache : new NullCache());
 }
开发者ID:terah,项目名称:fluent-pdo-model,代码行数:42,代码来源:OciPdo.php

示例7: connect

 /**
  * Connect to database server and select database
  */
 protected function connect()
 {
     if ($GLOBALS['TL_CONFIG']['dbPconnect']) {
         $this->resConnection = @oci_pconnect($GLOBALS['TL_CONFIG']['dbUser'], $GLOBALS['TL_CONFIG']['dbPass'], '', $GLOBALS['TL_CONFIG']['dbCharset']);
     } else {
         $this->resConnection = @oci_connect($GLOBALS['TL_CONFIG']['dbUser'], $GLOBALS['TL_CONFIG']['dbPass'], '', $GLOBALS['TL_CONFIG']['dbCharset']);
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:11,代码来源:DB_Oracle.php

示例8: connect

 /** 
  * DB接続
  * 
  * @access	public
  * @return	object	$db	接続ID
  */
 private function connect()
 {
     $dateTime = date("Y-m-d H:i:s");
     $this->conn = oci_pconnect($this->INI_DATA['database_user'], $this->INI_DATA['database_password'], ($this->INI_DATA['database_host'] ? $this->INI_DATA['database_host'] . "/" : "") . $this->INI_DATA['database_name']);
     if (!$this->conn) {
         $this->dbError("{$dateTime} <connect error> {$this->conn}");
     }
 }
开发者ID:neruchan,项目名称:cinderella.tiary.jp,代码行数:14,代码来源:ipfDB_oracle.php

示例9: getOraclePConnection

 public function getOraclePConnection()
 {
     $conn = oci_pconnect($this->username, $this->password, $this->host, $this->charset);
     if (!$conn) {
         $e = oci_error();
         trigger_error(htmlentities($e['message']), E_USER_ERROR);
     }
     return $conn;
 }
开发者ID:Szaharov,项目名称:GCB,代码行数:9,代码来源:OciOracleConnect.php

示例10: connect

 public function connect()
 {
     $conf = c("db.write");
     $conn_str = sprintf("(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = %s)(PORT = %s)) (CONNECT_DATA= (SID = %s)))", $conf['dbhost'], $conf['dbport'], $conf['dbname']);
     self::$link = oci_pconnect($con_user, $con_pwd, $conn_str, str_replace("-", "", $con_charset));
     if (!self::$link) {
         throw_exception(oci_error());
     }
 }
开发者ID:my1977,项目名称:shopnc,代码行数:9,代码来源:oci8.php

示例11: __construct

 /**
  * Creates a Connection to an Oracle Database using oci8 extension.
  *
  * @param string      $username
  * @param string      $password
  * @param string      $db
  * @param string|null $charset
  * @param integer     $sessionMode
  * @param boolean     $persistent
  *
  * @throws OCI8Exception
  */
 public function __construct($username, $password, $db, $charset = null, $sessionMode = OCI_DEFAULT, $persistent = false)
 {
     if (!defined('OCI_NO_AUTO_COMMIT')) {
         define('OCI_NO_AUTO_COMMIT', 0);
     }
     $this->dbh = $persistent ? @oci_pconnect($username, $password, $db, $charset, $sessionMode) : @oci_connect($username, $password, $db, $charset, $sessionMode);
     if (!$this->dbh) {
         throw OCI8Exception::fromErrorInfo(oci_error());
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:22,代码来源:OCI8Connection.php

示例12: connect

 protected function connect()
 {
     if ($this->lid == 0) {
         $charset = SITE_DB_CHARSET == 'cp1251' ? 'CL8MSWIN1251' : 'AL32UTF8';
         $this->lid = @oci_pconnect(SITE_DB_USER, SITE_DB_PASSWORD, SITE_DB_HOST, $charset);
         if (!$this->lid) {
             throw new Exception("Couldn't connect to server " . SITE_DB_HOST);
         }
         //if
     }
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:11,代码来源:class.dbdriveroracle.php

示例13: connect

 public function connect($config = [])
 {
     $this->config = $config;
     $dsn = !empty($this->config['dsn']) ? $this->config['dsn'] : $this->config['host'];
     if ($this->config['pconnect'] === true) {
         $this->connect = empty($this->config['charset']) ? @oci_pconnect($this->config['user'], $this->config['password'], $dsn) : @oci_pconnect($this->config['user'], $this->config['password'], $dsn, $this->config['charset']);
     } else {
         $this->connect = empty($this->config['charset']) ? @oci_connect($this->config['user'], $this->config['password'], $dsn) : @oci_connect($this->config['user'], $this->config['password'], $dsn, $this->config['charset']);
     }
     if (empty($this->connect)) {
         die(getErrorMessage('Database', 'connectError'));
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:13,代码来源:Oracle.php

示例14: __construct

 /**
  * Constructor opens a connection to the database
  * @param string $module Module text for End-to-End Application Tracing
  * @param string $cid Client Identifier for End-to-End Application Tracing
  */
 function __construct($module, $cid)
 {
     $this->conn = @oci_pconnect(SCHEMA, PASSWORD, DATABASE, CHARSET);
     if (!$this->conn) {
         $m = oci_error();
         throw new \Exception('No se puede conectar a la base de datos: ' . $m['message']);
     }
     // Record the "name" of the web user, the client info and the module.
     // These are used for end-to-end tracing in the DB.
     oci_set_client_info($this->conn, CLIENT_INFO);
     oci_set_module_name($this->conn, $module);
     oci_set_client_identifier($this->conn, $cid);
 }
开发者ID:nyandranzz,项目名称:todoticket,代码行数:18,代码来源:tt_db.inc.php

示例15: connect

 protected function connect()
 {
     if ($this->lnk === null) {
         $this->lnk = $this->settings->persist ? @oci_pconnect($this->settings->username, $this->settings->password, $this->settings->servername, $this->settings->charset) : @oci_connect($this->settings->username, $this->settings->password, $this->settings->servername, $this->settings->charset);
         if ($this->lnk === false) {
             throw new DatabaseException('Connect error');
         }
         $this->real("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'");
         if ($this->settings->timezone) {
             $this->real("ALTER session SET time_zone = '" . addslashes($this->settings->timezone) . "'");
         }
     }
 }
开发者ID:vakata,项目名称:database,代码行数:13,代码来源:Oracle.php


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