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

PHP odbc_pconnect函数代码示例

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

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



在下文中一共展示了odbc_pconnect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
     }
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:34,代码来源:odbc.php


示例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;
     }
 }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:33,代码来源:db2.php


示例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('');
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:31,代码来源:mssql_odbc.php


示例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");
     }
 }
开发者ID:quan2010,项目名称:DataDictionaryGenerator,代码行数:7,代码来源:Handler.php


示例5: Fconectar

function Fconectar()
{
    $dsn = "Drypers";
    $usuario = "reporte";
    $clave = "";
    //realizamos la conexion mediante odbc
    $conn = odbc_pconnect($dsn, $usuario, $clave);
    return $conn;
}
开发者ID:KatherinAguilera,项目名称:ProtisaReportes,代码行数:9,代码来源:libreria.php


示例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;
 }
开发者ID:qoire,项目名称:portal,代码行数:9,代码来源:adodb-odbc.inc.php


示例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'));
     }
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:9,代码来源:OdbcDriver.php


示例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('');
 }
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:9,代码来源:mssql-odbc.php


示例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;
 }
开发者ID:qoire,项目名称:portal,代码行数:10,代码来源:adodb-odbc_oracle.inc.php


示例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;
 }
开发者ID:antirek,项目名称:prestige-pbx,代码行数:10,代码来源:phplib_odbc.php


示例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;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:mssql-odbc.php


示例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);
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:14,代码来源:MSAccessDatabase.class.php


示例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;
 }
开发者ID:zendtech,项目名称:ibmitoolkit,代码行数:25,代码来源:Odbcsupp.php


示例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;
     }
 }
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:18,代码来源:OdbcDB.php


示例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;
     }
 }
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:19,代码来源:db2.php


示例16: connect

 function connect()
 {
     if (!$this->Connected) {
         $this->Query_ID = 0;
         if ($this->Persistent) {
             $this->Link_ID = odbc_pconnect($this->DBDatabase, $this->DBUser, $this->DBPassword, $this->UseODBCCursor);
         } else {
             $this->Link_ID = odbc_connect($this->DBDatabase, $this->DBUser, $this->DBPassword, $this->UseODBCCursor);
         }
         if (!$this->Link_ID) {
             $this->Halt("Cannot connect ot Database: " . odbc_errormsg());
             return false;
         }
         foreach ($this->Options as $option) {
             @odbc_setoption($this->Link_ID, $option[0], $option[1], $option[2]);
         }
         $this->Connected = true;
     }
 }
开发者ID:Okwori,项目名称:iRadiology,代码行数:19,代码来源:db_odbc.php


示例17: 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->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);
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $endtime = $mtime;
     $this->sql_time += $endtime - $starttime;
     return $this->db_connect_id ? $this->db_connect_id : false;
 }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:19,代码来源:msaccess.php


示例18: _pconnect

	function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
	{
	global $php_errormsg;
	
		if (!function_exists('odbc_connect')) return null;
		
		if (isset($php_errormsg)) $php_errormsg = '';
		$this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
		if ($this->debug && $argDatabasename) {
			ADOConnection::outp("For odbc PConnect(), $argDatabasename is not used. Place dsn in 1st parameter.");
		}
	//	print "dsn=$argDSN u=$argUsername p=$argPassword<br>"; flush();
		if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword);
		else $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,$this->curmode);
		
		$this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
		if ($this->_connectionID && $this->autoRollback) @odbc_rollback($this->_connectionID);
		if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
		
		return $this->_connectionID != false;
	}
开发者ID:joeymetal,项目名称:v1,代码行数:21,代码来源:adodb-odbc.inc.php


示例19: _pconnect

 function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
 {
     global $php_errormsg;
     $php_errormsg = '';
     if ($this->debug && $argDatabasename) {
         ADOConnection::outp("For odbc PConnect(), {$argDatabasename} is not used. Place dsn in 1st parameter.");
     }
     //	print "dsn=$argDSN u=$argUsername p=$argPassword<br>"; flush();
     if ($this->curmode === false) {
         $this->_connectionID = odbc_connect($argDSN, $argUsername, $argPassword);
     } else {
         $this->_connectionID = odbc_pconnect($argDSN, $argUsername, $argPassword, $this->curmode);
     }
     $this->_errorMsg = $php_errormsg;
     if ($this->_connectionID && $this->autoRollback) {
         @odbc_rollback($this->_connectionID);
     }
     return $this->_connectionID != false;
 }
开发者ID:sraj4,项目名称:EthicsPublicHtmlProd,代码行数:19,代码来源:adodb-odbc.inc.php


示例20: dbi_connect


//.........这里部分代码省略.........
                if ( ! mysqli_select_db ( $c, $database ) )
                  return false;
                */
                $GLOBALS["db_connection"] = $c;
                return $c;
            } else {
                return false;
            }
        } else {
            if (strcmp($GLOBALS["db_type"], "mssql") == 0) {
                if ($GLOBALS["db_persistent"]) {
                    $c = mssql_pconnect($host, $login, $password);
                } else {
                    $c = mssql_connect($host, $login, $password);
                }
                if ($c) {
                    if (!mssql_select_db($database)) {
                        return false;
                    }
                    return $c;
                } else {
                    return false;
                }
            } else {
                if (strcmp($GLOBALS["db_type"], "oracle") == 0) {
                    if (strlen($host) && strcmp($host, "localhost")) {
                        $c = OCIPLogon("{$login}@{$host}", $password, $database);
                    } else {
                        $c = OCIPLogon($login, $password, $database);
                    }
                    $GLOBALS["oracle_connection"] = $c;
                    return $c;
                } else {
                    if (strcmp($GLOBALS["db_type"], "postgresql") == 0) {
                        if (strlen($password)) {
                            if (strlen($host)) {
                                $dbargs = "host={$host} dbname={$database} user={$login} password={$password}";
                            } else {
                                $dbargs = "dbname={$database} user={$login} password={$password}";
                            }
                        } else {
                            if (strlen($host)) {
                                $dbargs = "host={$host} dbname={$database} user={$login}";
                            } else {
                                $dbargs = "dbname={$database} user={$login}";
                            }
                        }
                        if ($GLOBALS["db_persistent"]) {
                            $c = pg_pconnect($dbargs);
                        } else {
                            $c = pg_connect($dbargs);
                        }
                        $GLOBALS["postgresql_connection"] = $c;
                        if (!$c) {
                            echo "Error connecting to database\n";
                            exit;
                        }
                        return $c;
                    } else {
                        if (strcmp($GLOBALS["db_type"], "odbc") == 0) {
                            if ($GLOBALS["db_persistent"]) {
                                $c = odbc_pconnect($database, $login, $password);
                            } else {
                                $c = odbc_connect($database, $login, $password);
                            }
                            $GLOBALS["odbc_connection"] = $c;
                            return $c;
                        } else {
                            if (strcmp($GLOBALS["db_type"], "ibm_db2") == 0) {
                                if ($GLOBALS["db_persistent"]) {
                                    $c = db2_pconnect($database, $login, $password);
                                } else {
                                    $c = db2_connect($database, $login, $password);
                                }
                                $GLOBALS["ibm_db2_connection"] = $c;
                                return $c;
                            } else {
                                if (strcmp($GLOBALS["db_type"], "ibase") == 0) {
                                    $host = $host . ":" . $database;
                                    if ($GLOBALS["db_persistent"]) {
                                        $c = ibase_pconnect($host, $login, $password);
                                    } else {
                                        $c = ibase_connect($host, $login, $password);
                                    }
                                    return $c;
                                } else {
                                    if (empty($GLOBALS["db_type"])) {
                                        dbi_fatal_error("dbi_connect(): db_type not defined.");
                                    } else {
                                        dbi_fatal_error("dbi_connect(): invalid db_type '" . $GLOBALS["db_type"] . "'");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:101,代码来源:php-dbi.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP odbc_prepare函数代码示例发布时间:2022-05-15
下一篇:
PHP odbc_num_rows函数代码示例发布时间: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