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

PHP mssql_pconnect函数代码示例

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

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



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

示例1: sql_connect

 /**
  * Connect to server
  */
 function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
 {
     if (!function_exists('mssql_connect')) {
         $this->connect_error = 'mssql_connect function does not exist, is mssql extension installed?';
         return $this->sql_error('');
     }
     $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 : '');
     @ini_set('mssql.charset', 'UTF-8');
     @ini_set('mssql.textlimit', 2147483647);
     @ini_set('mssql.textsize', 2147483647);
     if (version_compare(PHP_VERSION, '5.1.0', '>=') || version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.1', '>=')) {
         $this->db_connect_id = $this->persistency ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link);
     } else {
         $this->db_connect_id = $this->persistency ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
     }
     if ($this->db_connect_id && $this->dbname != '') {
         if (!@mssql_select_db($this->dbname, $this->db_connect_id)) {
             @mssql_close($this->db_connect_id);
             return false;
         }
     }
     return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
 }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:30,代码来源:mssql.php


示例2: 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->server = $sqlserver . (($port) ? ':' . $port : '');
		$this->dbname = $database;

		@ini_set('mssql.charset', 'UTF-8');
		@ini_set('mssql.textlimit', 2147483647);
		@ini_set('mssql.textsize', 2147483647);

		if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.1', '>=')))
		{
			$this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link);
		}
		else
		{
			$this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
		}

		if ($this->db_connect_id && $this->dbname != '')
		{
			if (!@mssql_select_db($this->dbname, $this->db_connect_id))
			{
				@mssql_close($this->db_connect_id);
				return false;
			}
		}

		return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:34,代码来源:mssql.php


示例3: connect

 /**
  * {@inheritdoc}
  */
 public function connect()
 {
     $config = $this->config;
     $config = array_merge($this->baseConfig, $config);
     $os = env('OS');
     if (!empty($os) && strpos($os, 'Windows') !== false) {
         $sep = ',';
     } else {
         $sep = ':';
     }
     $this->connected = false;
     if (is_numeric($config['port'])) {
         $port = $sep . $config['port'];
         // Port number
     } elseif ($config['port'] === null) {
         $port = '';
         // No port - SQL Server 2005
     } else {
         $port = '\\' . $config['port'];
         // Named pipe
     }
     if (!$config['persistent']) {
         $this->connection = mssql_connect($config['host'] . $port, $config['username'], $config['password'], true);
     } else {
         $this->connection = mssql_pconnect($config['host'] . $port, $config['username'], $config['password']);
     }
     if (mssql_select_db($config['database'], $this->connection)) {
         $this->qery('SET DATEFORMAT ymd');
         $this->connected = true;
     }
     return $this->connection;
 }
开发者ID:speedwork,项目名称:database,代码行数:35,代码来源:MssqlDriver.php


示例4: Open

function Open($dbType, $connectType = "c", $connect, $username = "", $password = "", $dbName)
{
    switch ($dbType) {
        case "mssql":
            if ($connectType == "c") {
                $idCon = mssql_connect($connect, $username, $password);
            } else {
                $idCon = mssql_pconnect($connect, $username, $password);
            }
            mssql_select_db($dbName);
            break;
        case "mysql":
            if ($connectType == "c") {
                $idCon = @mysql_connect($connect, $username, $password);
            } else {
                $idCon = @mysql_pconnect($connect, $username, $password);
            }
            $idCon1 = mysql_select_db($dbName, $idCon);
            break;
        case "pg":
            if ($connectType == "c") {
                $idCon = pg_connect($connect . " user=" . $username . " password=" . $password . " dbname=" . $dbName);
            } else {
                $idCon = pg_pconnect($connect . " user=" . $username . " password=" . $password . " dbname=" . $dbName);
            }
            break;
        default:
            $idCon = 0;
            break;
    }
    return $idCon;
}
开发者ID:laiello,项目名称:ebpls,代码行数:32,代码来源:multidbconnection.php


示例5: StartConnection

 /**
  *	Start Connection Server
  *	Connect to Microsoft SQL Server
  *
  *	@return	void
  */
 public function StartConnection()
 {
     if (!extension_loaded("mssql")) {
         if (!extension_loaded("sqlsrv")) {
             return $this->results['Connect'] = "NO_PHP_EXTENSION";
         } else {
             $this->useSqlsrv = TRUE;
         }
     }
     if (!$this->settings['hostport']) {
         $this->settings['hostport'] = 1433;
     }
     $new_link = count($this->connections) > 0;
     $port = (strtoupper(substr(PHP_OS, 0, 3)) === "WIN" ? "," : ":") . $this->settings['hostport'];
     if (!$this->useSqlsrv) {
         if ($this->settings['persistent']) {
             $this->connections[$this->id] = mssql_pconnect($this->settings['hostname'] . $port, $this->settings['username'], $this->settings['password'], $new_link);
         } else {
             $this->connections[$this->id] = mssql_connect($this->settings['hostname'] . $port, $this->settings['username'], $this->settings['password'], $new_link);
         }
     }
     if (!$this->connections[$this->id]) {
         return $this->results['Connect'] = "CONNECTION_FAILED";
     }
     if (!$this->SelectDataBase($this->settings['database'], $this->id)) {
         return $this->results['Connect'] = "DATABASE_FAILED";
     }
     $this->id++;
     $this->connected = TRUE;
     $this->currentLink = $this->id - 1;
     return $this->results['Connect'] = "CONNECTED";
 }
开发者ID:ADMTec,项目名称:effectweb-project,代码行数:38,代码来源:mssqlClient.lib.php


示例6: db_pconnect

 /**
  * Persistent database connection
  *
  * @access	private called by the base class
  * @return	resource
  */
 function db_pconnect()
 {
     if ($this->port != '') {
         $this->hostname .= ',' . $this->port;
     }
     return @mssql_pconnect($this->hostname, $this->username, $this->password);
 }
开发者ID:arifh28,项目名称:siskalite,代码行数:13,代码来源:mssql_driver.php


示例7: reconnect

 function reconnect()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $this->__readserver = 'localhost';
     $user = $sgbl->__var_admin_user;
     $db = $sgbl->__var_dbf;
     $pass = getAdminDbPass();
     $readserver = $this->__readserver;
     $fdbvar = "__fdb_" . $this->__readserver;
     log_log("database_reconnect", "Reconnecting again");
     if ($sgbl->__var_database_type === 'mysql') {
         $gbl->{$fdbvar} = mysql_connect($readserver, $user, $pass);
         mysql_select_db($db);
         self::$__database = 'mysql';
     } else {
         if ($sgbl->__var_database_type === 'mssql') {
             //print("$user, $pass <br> \n");
             //$gbl->$fdbvar = mssql_connect('\\.\pipe\MSSQL$LXLABS\sql\query');
             $gbl->{$fdbvar} = mssql_pconnect("{$readserver},{$sgbl->__var_mssqlport}");
             mssql_select_db($db);
             self::$__database = 'mssql';
         } else {
             $gbl->{$fdbvar} = new PDO("sqlite:{$db}");
             self::$__database = 'sqlite';
         }
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:27,代码来源:sqlite.php


示例8: connect

 /**
  * Connect
  *
  * @param   bool reconnect default FALSE
  * @return  bool success
  * @throws  rdbms.SQLConnectException
  */
 public function connect($reconnect = false)
 {
     if (is_resource($this->handle)) {
         return true;
     }
     // Already connected
     if (!$reconnect && false === $this->handle) {
         return false;
     }
     // Previously failed connecting
     $this->_obs && $this->notifyObservers(new \rdbms\DBEvent(\rdbms\DBEvent::CONNECT, $reconnect));
     if ($this->flags & DB_PERSISTENT) {
         $this->handle = mssql_pconnect($this->dsn->getHost(), $this->dsn->getUser(), $this->dsn->getPassword());
     } else {
         $this->handle = mssql_connect($this->dsn->getHost(), $this->dsn->getUser(), $this->dsn->getPassword());
     }
     if (!is_resource($this->handle)) {
         $e = new \rdbms\SQLConnectException(trim(mssql_get_last_message()), $this->dsn);
         \xp::gc(__FILE__);
         throw $e;
     }
     \xp::gc(__FILE__);
     $this->_obs && $this->notifyObservers(new \rdbms\DBEvent(\rdbms\DBEvent::CONNECTED, $reconnect));
     return parent::connect();
 }
开发者ID:xp-framework,项目名称:rdbms,代码行数:32,代码来源:MsSQLConnection.class.php


示例9: 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->server = $sqlserver;
     $this->dbname = $database;
     $this->db_connect_id = $this->persistency ? @mssql_pconnect($this->server, $this->user, $this->password) : @mssql_connect($this->server, $this->user, $this->password);
     if ($this->db_connect_id && $this->dbname != "") {
         if (!mssql_select_db($this->dbname, $this->db_connect_id)) {
             mssql_close($this->db_connect_id);
             $mtime = microtime();
             $mtime = explode(" ", $mtime);
             $mtime = $mtime[1] + $mtime[0];
             $endtime = $mtime;
             $this->sql_time += $endtime - $starttime;
             return false;
         }
     }
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $endtime = $mtime;
     $this->sql_time += $endtime - $starttime;
     return $this->db_connect_id;
 }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:30,代码来源:mssql.php


示例10: connect

 public function connect()
 {
     if ($this->conn_id && $this->state == self::OPEN) {
         mssql_select_db($this->getDatabase(), $this->conn_id);
         return true;
     }
     //TODO preConnect actions should be called from here
     $hostString = $this->getHost();
     if ($this->getPort() != '') {
         $hostString .= ':' . $this->getPort();
     }
     if (isset($this->options['socket']) && $this->options['socket'] != '') {
         $hostString .= ':' . $this->options['socket'];
     }
     $flags = isset($this->options['flags']) ? $this->options['flags'] : null;
     if (isset($this->options['persistent']) && $this->options['persistent'] == true) {
         $this->conn_id = @mssql_pconnect($hostString, $this->getUser(), $this->getPassword(), $flags);
     } else {
         $this->conn_id = @mssql_connect($hostString, $this->getUser(), $this->getPassword(), $flags);
     }
     if (!$this->conn_id) {
         $this->state = self::CLOSED;
         $msg = '[!Database connection error!]: ' . $this->getDatabase() . ' - ' . $this->getErrorMsg();
         PhpBURN_Message::output($msg, PhpBURN_Message::ERROR);
         return false;
     }
     //Selecting database
     mssql_select_db($this->getDatabase(), $this->conn_id);
     $this->state = self::OPEN;
     //TODO onConnectSucess actions should be called from here
     return true;
 }
开发者ID:phpburn,项目名称:phpburn,代码行数:32,代码来源:PDO_MSSQL.php


示例11: connect

 public function connect()
 {
     $this->link = $this->_config['pconnect'] == 0 ? @mssql_connect($this->_config['host'], $this->_config['username'], $this->_config['password']) : @mssql_pconnect($this->_config['host'], $this->_config['username'], $this->_config['password']);
     if (!$this->link) {
         $this->halt("Connect to mssql  failed");
     }
     $this->selectDb();
 }
开发者ID:quan2010,项目名称:DataDictionaryGenerator,代码行数:8,代码来源:Handler.php


示例12: connect

 /**
  * Connects to the database.
  *
  * @param   string $host
  * @param   string $username
  * @param   string $password
  * @param   string $db_name
  * @return  boolean TRUE, if connected, otherwise FALSE
  */
 function connect($host, $user, $passwd, $db)
 {
     $this->conn = mssql_pconnect($host, $user, $passwd);
     if (empty($db) or $this->conn == false) {
         PMF_Db::errorPage(mssql_get_last_message());
         die;
     }
     return mssql_select_db($db, $this->conn);
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:18,代码来源:Mssql.php


示例13: connect

 function connect($host = '127.0.0.1', $user = 'sa', $passwd = 'sa')
 {
     $this->con = mssql_pconnect($host, $user, $passwd);
     if (!$this->con) {
         $this->debug('Connect To Host : ' . $host . ' Faild!');
     }
     $this->query('SET TEXTSIZE 2147483647');
     return $this->con;
 }
开发者ID:h3len,项目名称:Project,代码行数:9,代码来源:mssql.php


示例14: connect

 /**
  * Connect to the database.
  * @param str[] config
  */
 function connect($config)
 {
     $connString = sprintf('host=%s dbname=%s user=%s password=%s', $config['server'], $config['database'], $config['username'], $config['password']);
     if ($this->db = mssql_pconnect($config['server'], $config['username'], $config['password'])) {
         mssql_select_db($config['database']);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:idaoya,项目名称:php-rest-sql,代码行数:13,代码来源:mssql.php


示例15: connect

 public function connect($config = array())
 {
     $this->config = $config;
     $server = !empty($this->config['server']) ? $this->config['server'] : $this->config['host'];
     $this->connect = $this->config['pconnect'] === true ? @mssql_pconnect($server, $this->config['user'], $this->config['password']) : @mssql_connect($server, $this->config['user'], $this->config['password']);
     if (empty($this->connect)) {
         die(getErrorMessage('Database', 'mysqlConnectError'));
     }
     mssql_select_db($this->config['database'], $this->connect);
 }
开发者ID:bytemtek,项目名称:znframework,代码行数:10,代码来源:Mssql.php


示例16: openConnection

 public function openConnection()
 {
     $this->conm = mssql_pconnect($this->url, $this->login, $this->password);
     if (mssql_select_db($this->db, $this->conm)) {
         return true;
     } else {
         $this->sendMail("[email protected]", "Error in SattransData", "Error: {$php_errormsg}\r\n");
         return false;
     }
 }
开发者ID:mmiihaisyrbu,项目名称:gps_data,代码行数:10,代码来源:SattransData.php


示例17: connection

 private function connection()
 {
     $this->objCon = @mssql_pconnect($this->mssqlLibHost, $this->mssqlLibUser, $this->mssqlLibPassword);
     if ($this->objCon == false) {
         throw new SqlException("Connection error.\n<!-- SQL Message: " . mssql_get_last_message() . " -->");
     }
     if (@mssql_select_db($this->mssqlLibDatabase, $this->objCon) == false) {
         throw new SqlException("Database error.\n<!-- SQL Message: " . mssql_get_last_message() . " -->");
     }
 }
开发者ID:ADMTec,项目名称:ldManager-MuOnline,代码行数:10,代码来源:ldMssql.class.php


示例18: init

 /**
  * Initialize the driver.
  *
  * Validate configuration and perform all resource-intensive tasks needed to
  * make the driver active.
  *
  * @throws ILSException
  * @return void
  */
 public function init()
 {
     if (empty($this->config)) {
         throw new ILSException('Configuration needs to be set.');
     }
     // Connect to database
     $this->db = mssql_pconnect($this->config['Catalog']['host'] . ':' . $this->config['Catalog']['port'], $this->config['Catalog']['username'], $this->config['Catalog']['password']);
     // Select the databse
     mssql_select_db($this->config['Catalog']['database']);
 }
开发者ID:guenterh,项目名称:vufind,代码行数:19,代码来源:Horizon.php


示例19: renewConnection

 public function renewConnection()
 {
     $this->connection = mssql_pconnect($_SESSION["DBData"]["host"], $_SESSION["DBData"]["user"], $_SESSION["DBData"]["password"]);
     if (!$this->connection) {
         throw new NoDBUserDataException();
     }
     if (!mssql_select_db($_SESSION["DBData"]["datab"], $this->connection)) {
         throw new DatabaseNotFoundException();
     }
 }
开发者ID:nemiah,项目名称:projectMankind,代码行数:10,代码来源:MSSQLStorage.class.php


示例20: connect

 function connect()
 {
     if (0 == $this->Link_ID) {
         $this->Link_ID = mssql_pconnect($this->Host, $this->User, $this->Password);
         if (!$this->Link_ID) {
             $this->halt("Link-ID == false, mssql_pconnect failed");
         } else {
             mssql_select_db($this->Database, $this->Link_ID);
         }
     }
 }
开发者ID:hardikk,项目名称:HNH,代码行数:11,代码来源:phplib_mssql.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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