本文整理汇总了PHP中odbc_pconnect函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_pconnect函数的具体用法?PHP odbc_pconnect怎么用?PHP odbc_pconnect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了odbc_pconnect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
* Connects to a database.
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
DibiConnection::alias($config, 'username', 'user');
DibiConnection::alias($config, 'password', 'pass');
if (isset($config['resource'])) {
$this->connection = $config['resource'];
} else {
// default values
if (!isset($config['username'])) {
$config['username'] = ini_get('odbc.default_user');
}
if (!isset($config['password'])) {
$config['password'] = ini_get('odbc.default_pw');
}
if (!isset($config['dsn'])) {
$config['dsn'] = ini_get('odbc.default_db');
}
if (empty($config['persistent'])) {
$this->connection = @odbc_connect($config['dsn'], $config['username'], $config['password']);
// intentionally @
} else {
$this->connection = @odbc_pconnect($config['dsn'], $config['username'], $config['password']);
// intentionally @
}
}
if (!is_resource($this->connection)) {
throw new DibiDriverException(odbc_errormsg() . ' ' . odbc_error());
}
}
示例2: sql_db
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->dbname = $database;
$this->server = $sqlserver;
if ($this->persistency) {
$this->db_connect_id = odbc_pconnect($this->server, "", "");
} else {
$this->db_connect_id = odbc_connect($this->server, "", "");
}
if ($this->db_connect_id) {
@odbc_autocommit($this->db_connect_id, off);
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$this->sql_time += $endtime - $starttime;
return $this->db_connect_id;
} else {
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$this->sql_time += $endtime - $starttime;
return false;
}
}
示例3: sql_connect
/**
* Connect to server
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->dbname = $database;
$port_delimiter = defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN' ? ',' : ':';
$this->server = $sqlserver . ($port ? $port_delimiter . $port : '');
$max_size = @ini_get('odbc.defaultlrl');
if (!empty($max_size)) {
$unit = strtolower(substr($max_size, -1, 1));
$max_size = (int) $max_size;
if ($unit == 'k') {
$max_size = floor($max_size / 1024);
} else {
if ($unit == 'g') {
$max_size *= 1024;
} else {
if (is_numeric($unit)) {
$max_size = floor((int) ($max_size . $unit) / 1048576);
}
}
}
$max_size = max(8, $max_size) . 'M';
@ini_set('odbc.defaultlrl', $max_size);
}
$this->db_connect_id = $this->persistency ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword);
return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
}
示例4: connect
public function connect()
{
$this->link = $this->_config['pconnect'] == 0 ? @odbc_connect($this->_config['dsn'], $this->_config['username'], $this->_config['password'], SQL_CUR_USE_ODBC) : odbc_pconnect($this->_config['dsn'], $this->_config['username'], $this->_config['password'], SQL_CUR_USE_ODBC);
if (!$this->link) {
$this->halt("Connect to odbc failed");
}
}
示例5: Fconectar
function Fconectar()
{
$dsn = "Drypers";
$usuario = "reporte";
$clave = "";
//realizamos la conexion mediante odbc
$conn = odbc_pconnect($dsn, $usuario, $clave);
return $conn;
}
示例6: _pconnect
function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
{
global $php_errormsg;
$php_errormsg = '';
$this->_connectionID = odbc_pconnect($argDSN, $argUsername, $argPassword, $this->curmode);
$this->_errorMsg = $php_errormsg;
//if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
return $this->_connectionID != false;
}
示例7: connect
public function connect($config = array())
{
$this->config = $config;
$dsn = !empty($this->config['dsn']) ? $this->config['dsn'] : 'DRIVER=' . $this->config['host'] . ';SERVER=' . $this->config['server'] . ';DATABASE=' . $this->config['database'];
$this->connect = $this->config['pconnect'] === true ? @odbc_pconnect($dsn, $this->config['user'], $this->config['password']) : @odbc_connect($dsn, $this->config['user'], $this->config['password']);
if (empty($this->connect)) {
die(getErrorMessage('Database', 'mysqlConnectError'));
}
}
示例8: sql_connect
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver . ($port ? ':' . $port : '');
$this->dbname = $database;
$this->db_connect_id = $this->persistency ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword);
return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
}
示例9: _pconnect
function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
{
global $php_errormsg;
$php_errormsg = '';
$this->_connectionID = odbc_pconnect($argDSN, $argUsername, $argPassword, SQL_CUR_USE_ODBC);
$this->_errorMsg = $php_errormsg;
$this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
//if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
return $this->_connectionID != false;
}
示例10: connect
function connect()
{
if (0 == $this->Link_ID) {
$this->Link_ID = odbc_pconnect($this->Database, $this->User, $this->Password, $this->UseODBCCursor);
if (!$this->Link_ID) {
$this->halt("Link-ID == false, odbc_pconnect failed");
}
}
return $this->Link_ID;
}
示例11: sql_db
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->server = $sqlserver;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->dbname = $database;
$this->db_connect_id = $this->persistency ? odbc_pconnect($this->server, $this->user, $this->password) : odbc_connect($this->server, $this->user, $this->password);
return $this->db_connect_id ? $this->db_connect_id : false;
}
示例12: selectDatabase
/**
* Opens a MS Access database.
*/
protected function selectDatabase()
{
if ($this->usePConnect) {
$this->linkID = @odbc_pconnect("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" . $this->database, '', '');
} else {
$this->linkID = @odbc_connect("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" . $this->database, '', '');
}
if ($this->linkID === false) {
throw new DatabaseException("Cannot use database " . $this->database, $this);
}
}
示例13: connect
/**
*
* @todo should perhaps handle this method differently if $options are not passed
*
* @param $database
* @param $user
* @param $password
* @param null $options
* @return bool|resource
*/
public function connect($database, $user, $password, $options = null)
{
if ($options) {
if (isset($options['persistent']) && $options['persistent']) {
$conn = odbc_pconnect($database, $user, $password);
} else {
$conn = odbc_connect($database, $user, $password);
}
if (is_resource($conn)) {
return $conn;
}
}
$this->setError();
return false;
}
示例14: connect
function connect($dsn, $db = '', $user, $password, $persistent = false)
{
parent::connect($dsn, $db, $user, $password, $persistent);
$this->dsn = $dsn;
$this->host = '';
$this->db = '';
if ($persistent) {
$this->db = odbc_pconnect($dsn, $user, $password);
} else {
$this->db = odbc_connect($dsn, $user, $password);
}
if ($this->db) {
return true;
} else {
$this->_addError('Error connecting to db!', 'connect()');
return false;
}
}
示例15: sql_db
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->dbname = $database;
$this->server = $sqlserver;
if ($this->persistency) {
$this->db_connect_id = odbc_pconnect($this->server, "", "");
} else {
$this->db_connect_id = odbc_connect($this->server, "", "");
}
if ($this->db_connect_id) {
@odbc_autocommit($this->db_connect_id, off);
return $this->db_connect_id;
} else {
return false;
}
}