本文整理汇总了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'];
}
示例2: server_version
public function server_version()
{
if ($this->lnk) {
$info = sqlsrv_server_info($this->lnk);
return $info['SQLServerVersion'];
}
return false;
}
示例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';
}
示例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;
}
示例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;
}
示例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;
}
示例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'];
}
示例8: getVersion
public function getVersion()
{
return sqlsrv_server_info($this->_connected);
}
示例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;
}
示例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;
}
示例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']);
}
示例12: testServer
/**
* @depends testConnection
*/
public function testServer($con)
{
echo "\nServer info test.";
// TODO: make better tests
$this->assertTrue(is_array(sqlsrv_server_info($con)));
}
示例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;
}
示例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;
}
示例15: version
/**
* Return the database version.
*
* @return string
*/
public function version()
{
$server = sqlsrv_server_info($this->connection);
return $server['SQLServerName'] . ': ' . $server['SQLServerVersion'];
}