当前位置: 首页>>代码示例>>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;未经允许,请勿转载。