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

PHP oci_pconnect函数代码示例

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

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



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


示例16: connect

 /**
  * Make a Connect to the oracle Server
  *
  * @param string $host
  * @param string $user
  * @param string $pass
  * @param string $db
  * @param string $schema optional
  * @param string $enconding optional
  * @return mixed return connection resource
  */
 function connect($host, $user, $pass, $db, $schema = "", $encoding = "")
 {
     if ($this->CLASS['config']->db->pconnect) {
         $this->connection = oci_pconnect($user, $pass, $db, $encoding);
     } else {
         $this->connection = oci_connect($user, $pass, $db, $encoding);
     }
     if (!$this->connection) {
         $this->CLASS['error']->log("Cannnot connect to host!", 1, "class-oracle.php::connect");
         exit;
     }
     return $this->connection;
 }
开发者ID:zenga22,项目名称:knowledgeroot1,代码行数:24,代码来源:class-oracle.php


示例17: Connect

 public function Connect($host, $user, $pass, $mode = OCI_DEFAULT, $type = ORA_CONNECTION_TYPE_DEFAULT)
 {
     switch ($type) {
         case ORA_CONNECTION_TYPE_PERSISTENT:
             $this->conn_handle = oci_pconnect($user, $pass, $host, $this->charset, $mode);
             break;
         case ORA_CONNECTION_TYPE_NEW:
             $this->conn_handle = oci_new_connect($user, $pass, $host, $this->charset, $mode);
             break;
         default:
             $this->conn_handle = oci_connect($user, $pass, $host, $this->charset, $mode);
     }
     return is_resource($this->conn_handle) ? true : false;
 }
开发者ID:Zniel,项目名称:fl_crtlpanel_self_dev,代码行数:14,代码来源:pm_oracle.class.php


示例18: __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())
 {
     $parsedDsn = Pdo_Util::parseDsn($dsn, array('dbname', 'charset'));
     if (isset($options[PDO::ATTR_PERSISTENT]) && $options[PDO::ATTR_PERSISTENT]) {
         $this->_dbh = @oci_pconnect($username, $password, $parsedDsn['dbname'], $parsedDsn['charset']);
     } else {
         $this->_dbh = @oci_connect($username, $password, $parsedDsn['dbname'], $parsedDsn['charset']);
     }
     if (!$this->_dbh) {
         $e = oci_error();
         throw new PDOException($e['message']);
     }
     $this->_options = $options;
 }
开发者ID:Evan-github,项目名称:pdo_oci8,代码行数:23,代码来源:Oci8.php


示例19: _connect

 /**
  * Connects to the database.
  *
  * @return void
  * @throw eZClusterHandlerDBNoConnectionException
  * @throw eZClusterHandlerDBNoDatabaseException
  **/
 public function _connect()
 {
     if (!function_exists('oci_connect')) {
         throw new eZClusterHandlerDBNoDatabaseException("PECL oci8 extension (http://pecl.php.net/package/oci8) is required to use Oracle clustering functionality.");
     }
     // DB Connection setup
     // This part is not actually required since _connect will only be called
     // once, but it is useful to run the unit tests. So be it.
     // @todo refactor this using eZINI::setVariable in unit tests
     if (self::$dbparams === null) {
         $siteINI = eZINI::instance('site.ini');
         $fileINI = eZINI::instance('file.ini');
         self::$dbparams = array();
         //self::$dbparams['host']       = $fileINI->variable( 'eZDFSClusteringSettings', 'DBHost' );
         //self::$dbparams['port']       = $fileINI->variable( 'eZDFSClusteringSettings', 'DBPort' );
         //self::$dbparams['socket']     = $fileINI->variable( 'eZDFSClusteringSettings', 'DBSocket' );
         self::$dbparams['dbname'] = $fileINI->variable('eZDFSClusteringSettings', 'DBName');
         self::$dbparams['user'] = $fileINI->variable('eZDFSClusteringSettings', 'DBUser');
         self::$dbparams['pass'] = $fileINI->variable('eZDFSClusteringSettings', 'DBPassword');
         self::$dbparams['max_connect_tries'] = $fileINI->variable('eZDFSClusteringSettings', 'DBConnectRetries');
         self::$dbparams['max_execute_tries'] = $fileINI->variable('eZDFSClusteringSettings', 'DBExecuteRetries');
         self::$dbparams['sql_output'] = $siteINI->variable("DatabaseSettings", "SQLOutput") == "enabled";
         self::$dbparams['cache_generation_timeout'] = $siteINI->variable("ContentSettings", "CacheGenerationTimeout");
         self::$dbparams['persistent_connection'] = $fileINI->hasVariable('eZDFSClusteringSettings', 'DBPersistentConnection') ? $fileINI->variable('eZDFSClusteringSettings', 'DBPersistentConnection') == 'enabled' : false;
     }
     $maxTries = self::$dbparams['max_connect_tries'];
     $tries = 0;
     eZPerfLogger::accumulatorStart('oracle_cluster_connect', 'Oracle Cluster', 'Cluster database connection');
     while ($tries < $maxTries) {
         if (self::$dbparams['persistent_connection']) {
             if ($this->db = oci_pconnect(self::$dbparams['user'], self::$dbparams['pass'], self::$dbparams['dbname'])) {
                 break;
             }
         } else {
             if ($this->db = oci_connect(self::$dbparams['user'], self::$dbparams['pass'], self::$dbparams['dbname'])) {
                 break;
             }
         }
         ++$tries;
     }
     eZPerfLogger::accumulatorStop('oracle_cluster_connect');
     if (!$this->db) {
         throw new eZClusterHandlerDBNoConnectionException(self::$dbparams['dbname'], self::$dbparams['user'], self::$dbparams['pass']);
     }
     // DFS setup
     if ($this->dfsbackend === null) {
         $this->dfsbackend = new eZDFSFileHandlerTracing50DFSBackend();
     }
 }
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:56,代码来源:tracingoracle.php


示例20: __construct

 /**
  * Creates a Connection to an Oracle Database using oci8 extension.
  *
  * @param string $dsn Oracle connection string in oci_connect format.
  * @param string $username Oracle username.
  * @param string $password Oracle user's password.
  * @param array $options Additional connection settings.
  *
  * @throws OCI8Exception
  */
 public function __construct($dsn, $username, $password, $options)
 {
     $persistent = !empty($options['persistent']);
     $charset = !empty($options['charset']) ? $options['charset'] : null;
     $sessionMode = !empty($options['sessionMode']) ? $options['sessionMode'] : null;
     if ($persistent) {
         $this->dbh = @oci_pconnect($username, $password, $dsn, $charset, $sessionMode);
     } else {
         $this->dbh = @oci_connect($username, $password, $dsn, $charset, $sessionMode);
     }
     if (!$this->dbh) {
         throw OCI8Exception::fromErrorInfo(oci_error());
     }
     $this->config($options);
 }
开发者ID:cakedc,项目名称:cakephp-oracle-driver,代码行数:25,代码来源:OCI8Connection.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP oci_result函数代码示例发布时间:2022-05-15
下一篇:
PHP oci_parse函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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