當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sqlsrv_server_info函數代碼示例

本文整理匯總了PHP中sqlsrv_server_info函數的典型用法代碼示例。如果您正苦於以下問題:PHP sqlsrv_server_info函數的具體用法?PHP sqlsrv_server_info怎麽用?PHP sqlsrv_server_info使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了sqlsrv_server_info函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: connect

 /**
  * Connects to a database.
  * @return void
  * @throws Dibi\Exception
  */
 public function connect(array &$config)
 {
     Helpers::alias($config, 'options|UID', 'username');
     Helpers::alias($config, 'options|PWD', 'password');
     Helpers::alias($config, 'options|Database', 'database');
     Helpers::alias($config, 'options|CharacterSet', 'charset');
     if (isset($config['resource'])) {
         $this->connection = $config['resource'];
     } else {
         $options =& $config['options'];
         // Default values
         if (!isset($options['CharacterSet'])) {
             $options['CharacterSet'] = 'UTF-8';
         }
         $options['PWD'] = (string) $options['PWD'];
         $options['UID'] = (string) $options['UID'];
         $options['Database'] = (string) $options['Database'];
         $this->connection = sqlsrv_connect($config['host'], $options);
     }
     if (!is_resource($this->connection)) {
         $info = sqlsrv_errors();
         throw new Dibi\DriverException($info[0]['message'], $info[0]['code']);
     }
     $this->version = sqlsrv_server_info($this->connection)['SQLServerVersion'];
 }
開發者ID:ludik1,項目名稱:transport_company,代碼行數:30,代碼來源:SqlsrvDriver.php

示例2: server_version

 public function server_version()
 {
     if ($this->lnk) {
         $info = sqlsrv_server_info($this->lnk);
         return $info['SQLServerVersion'];
     }
     return false;
 }
開發者ID:yunsite,項目名稱:yuan-pad,代碼行數:8,代碼來源:Ymssql.php

示例3: sql_server_info

 /**
  * {@inheritDoc}
  */
 function sql_server_info($raw = false, $use_cache = true)
 {
     global $cache;
     if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) {
         $arr_server_info = sqlsrv_server_info($this->db_connect_id);
         $this->sql_server_version = $arr_server_info['SQLServerVersion'];
         if (!empty($cache) && $use_cache) {
             $cache->put('mssql_version', $this->sql_server_version);
         }
     }
     if ($raw) {
         return $this->sql_server_version;
     }
     return $this->sql_server_version ? 'MSSQL<br />' . $this->sql_server_version : 'MSSQL';
 }
開發者ID:MrAdder,項目名稱:phpbb,代碼行數:18,代碼來源:mssqlnative.php

示例4: __connect

 /**
  * DB Connect
  * this method is private
  * @param array $connection connection's value is db_hostname, db_database, db_userid, db_password
  * @return resource
  */
 function __connect($connection)
 {
     //sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
     //sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
     //sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL );
     $result = @sqlsrv_connect($connection['host'], array('Database' => $connection['database'], 'UID' => $connection['user'], 'PWD' => $connection['pass']));
     if (!$result) {
         $errors = print_r(sqlsrv_errors(), true);
         $this->setError(-1, 'database connect fail' . PHP_EOL . $errors);
         return;
     }
     $server_info = sqlsrv_server_info($result);
     $server_version = $server_info['SQLServerVersion'];
     if ($server_version && version_compare($server_version, '10', '<')) {
         $this->setError(-1, 'Rhymix requires Microsoft SQL Server 2008 or later. Current version is ' . $server_version);
         return;
     }
     return $result;
 }
開發者ID:rhymix,項目名稱:rhymix,代碼行數:25,代碼來源:DBMssql.class.php

示例5: get_server_info

 /**
  * Returns database server info array
  * @return array Array containing 'description', 'version' and 'database' (current db) info
  */
 public function get_server_info()
 {
     static $info;
     if (!$info) {
         $server_info = sqlsrv_server_info($this->sqlsrv);
         if ($server_info) {
             $info['description'] = $server_info['SQLServerName'];
             $info['version'] = $server_info['SQLServerVersion'];
             $info['database'] = $server_info['CurrentDatabase'];
         }
     }
     return $info;
 }
開發者ID:mongo0se,項目名稱:moodle,代碼行數:17,代碼來源:sqlsrv_native_moodle_database.php

示例6: getServerVersion

 /**
  * @return string Version information from the database
  */
 public function getServerVersion()
 {
     $server_info = sqlsrv_server_info($this->mConn);
     $version = 'Error';
     if (isset($server_info['SQLServerVersion'])) {
         $version = $server_info['SQLServerVersion'];
     }
     return $version;
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:12,代碼來源:DatabaseMssql.php

示例7: version

 /**
  * Database version number
  *
  * @return	string
  */
 public function version()
 {
     if (isset($this->data_cache['version'])) {
         return $this->data_cache['version'];
     } elseif (!$this->conn_id) {
         $this->initialize();
     }
     if (!$this->conn_id or ($info = sqlsrv_server_info($this->conn_id)) === FALSE) {
         return FALSE;
     }
     return $this->data_cache['version'] = $info['SQLServerVersion'];
 }
開發者ID:nuit-de-l-info,項目名稱:2015-ndl-jj,代碼行數:17,代碼來源:sqlsrv_driver.php

示例8: getVersion

 public function getVersion()
 {
     return sqlsrv_server_info($this->_connected);
 }
開發者ID:autoset,項目名稱:santorini,代碼行數:4,代碼來源:MssqlDriver.class.php

示例9: getServerVersion

 /**
  * Retrieve server version in PHP style
  *
  * @return string
  */
 public function getServerVersion()
 {
     $this->_connect();
     $serverInfo = sqlsrv_server_info($this->_connection);
     if ($serverInfo !== false) {
         return $serverInfo['SQLServerVersion'];
     }
     return null;
 }
開發者ID:Simarpreet05,項目名稱:joomla,代碼行數:14,代碼來源:Sqlsrv.php

示例10: getServerVersion

 /**
  * return version information about the server
  *
  * @param bool   $native  determines if the raw version string should be returned
  * @return mixed array/string with version information or MDB2 error object
  * @access public
  */
 function getServerVersion($native = false)
 {
     if ($this->connected_server_info) {
         $server_info = $this->connected_server_info;
     } else {
         $this->connect();
         $server_info = sqlsrv_server_info($this->connection);
     }
     // cache server_info
     $this->connected_server_info = $server_info;
     $version = $server_info['SQLServerVersion'];
     if (!$native) {
         if (preg_match('/(\\d+)\\.(\\d+)\\.(\\d+)/', $version, $tmp)) {
             $version = array('major' => $tmp[1], 'minor' => $tmp[2], 'patch' => $tmp[3], 'extra' => null, 'native' => $version);
         } else {
             $version = array('major' => null, 'minor' => null, 'patch' => null, 'extra' => null, 'native' => $version);
         }
     }
     return $version;
 }
開發者ID:Dulciane,項目名稱:jaws,代碼行數:27,代碼來源:sqlsrv.php

示例11: _version

 /**
  * Version number query string
  *
  * @access public
  * @return string
  */
 function _version()
 {
     $info = sqlsrv_server_info($this->conn_id);
     return sprintf("select '%s' as ver", $info['SQLServerVersion']);
 }
開發者ID:pmward,項目名稱:Codeigniter-Braintree-v.zero-test-harness,代碼行數:11,代碼來源:sqlsrv_driver.php

示例12: testServer

 /**
  * @depends testConnection
  */
 public function testServer($con)
 {
     echo "\nServer info test.";
     // TODO: make better tests
     $this->assertTrue(is_array(sqlsrv_server_info($con)));
 }
開發者ID:radsectors,項目名稱:sqlshim,代碼行數:9,代碼來源:GeneralTest.php

示例13: getDbInfo

 /**
  * (non-PHPdoc)
  * @see DBManager::getDbInfo()
  * @return array
  */
 public function getDbInfo()
 {
     $info = array_merge(sqlsrv_client_info($this->database), sqlsrv_server_info($this->database));
     return $info;
 }
開發者ID:jglaine,項目名稱:sugar761-ent,代碼行數:10,代碼來源:SqlsrvManager.php

示例14: cs_sql_version

function cs_sql_version($cs_file)
{
    global $cs_db;
    $sql_infos = array('data_free' => 0, 'data_size' => 0, 'index_size' => 0, 'tables' => 0, 'names' => array());
    $client = sqlsrv_client_info($cs_db['con']);
    $server = sqlsrv_server_info($cs_db['con']);
    $sql_infos['encoding'] = 'default';
    $sql_infos['type'] = 'Microsoft SQL Server (sqlsrv)';
    $sql_infos['client'] = $client['DriverVer'] . ' - ODBC ' . $client['DriverODBCVer'];
    $sql_infos['host'] = $server['SQLServerName'];
    $sql_infos['server'] = $server['SQLServerVersion'];
    return $sql_infos;
}
開發者ID:aberrios,項目名稱:WEBTHESGO,代碼行數:13,代碼來源:sqlsrv.php

示例15: version

 /**
  * Return the database version.
  *
  * @return string
  */
 public function version()
 {
     $server = sqlsrv_server_info($this->connection);
     return $server['SQLServerName'] . ': ' . $server['SQLServerVersion'];
 }
開發者ID:akinyeleolubodun,項目名稱:PhireCMS2,代碼行數:10,代碼來源:Sqlsrv.php


注:本文中的sqlsrv_server_info函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。