本文整理汇总了PHP中pg_version函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_version函数的具体用法?PHP pg_version怎么用?PHP pg_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pg_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: connect
/**
* Connect to database
*
* @param array $options
* @return array
*/
public function connect($options)
{
$result = ['version' => null, 'status' => 0, 'error' => [], 'errno' => 0, 'success' => false];
// we could pass an array or connection string right a way
if (is_array($options)) {
$str = 'host=' . $options['host'] . ' port=' . $options['port'] . ' dbname=' . $options['dbname'] . ' user=' . $options['username'] . ' password=' . $options['password'];
} else {
$str = $options;
}
$connection = pg_connect($str);
if ($connection !== false) {
$this->db_resource = $connection;
$this->connect_options = $options;
$this->commit_status = 0;
pg_set_error_verbosity($connection, PGSQL_ERRORS_VERBOSE);
pg_set_client_encoding($connection, 'UNICODE');
$result['version'] = pg_version($connection);
$result['status'] = pg_connection_status($connection) === PGSQL_CONNECTION_OK ? 1 : 0;
$result['success'] = true;
} else {
$result['error'][] = 'db::connect() : Could not connect to database server!';
$result['errno'] = 1;
}
return $result;
}
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:31,代码来源:base.php
示例2: getAttribute
public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null)
{
switch ($attribute) {
case PDO::ATTR_AUTOCOMMIT:
return $this->autocommit;
break;
case PDO::ATTR_CLIENT_VERSION:
$ver = pg_version($this->link);
return $ver['client'];
break;
case PDO::ATTR_CONNECTION_STATUS:
if (pg_connection_status($this->link) === PGSQL_CONNECTION_OK) {
return 'Connection OK; waiting to send.';
} else {
return 'Connection BAD';
}
break;
case PDO::ATTR_SERVER_INFO:
return sprintf('PID: %d; Client Encoding: %s; Is Superuser: %s; Session Authorization: %s; Date Style: %s', pg_get_pid($this->link), pg_client_encoding($this->link), pg_parameter_status($this->link, 'is_superuser'), pg_parameter_status($this->link, 'session_authorization'), pg_parameter_status($this->link, 'DateStyle'));
break;
case PDO::ATTR_SERVER_VERSION:
return pg_parameter_status($this->link, 'server_version');
break;
default:
return parent::getAttribute($attribute, $source, $func, $last_error);
break;
}
}
开发者ID:PHPcomaptibility,项目名称:PHPPDO,代码行数:28,代码来源:pgsql.php
示例3: lastInsertId
public function lastInsertId()
{
$_temp = $this->lastHash;
$lastResult = $this->results[$this->lastHash];
$this->executeQuery("SELECT version() AS ver");
$row = $this->getRow();
$ver = pg_version($this->connection);
$v = $ver['server'];
$table = func_num_args() > 0 ? func_get_arg(0) : null;
$column = func_num_args() > 1 ? func_get_arg(1) : null;
if ($table == null && $v == '8.1') {
$sql = "SELECT LASTVAL() AS ins_id";
} elseif ($table != null && $column != null && $v >= '8.0') {
$sql = sprintf("SELECT pg_get_serial_sequence('%s','%s') as seq", $table, $column);
$this->execte($sql);
$row = $this->getRow();
$sql = sprintf("SELECT CURRVAL('%s') as ins_id", $row['seq']);
} elseif ($table != null) {
// seq_name passed in table parameter
$sql = sprintf("SELECT CURRVAL('%s') as ins_id", $table);
} else {
return pg_last_oid($lastResult);
}
$this->execute($sql);
$row = $this->getRow();
$this->lasthash = $_temp;
return $row['ins_id'];
}
开发者ID:prajeenapk,项目名称:VioletPHP,代码行数:28,代码来源:postgresqlDriver.php
示例4: navi
function navi()
{
global $SIDU;
$conn = $SIDU['conn'][$SIDU[0]];
$link = @explode(',', $_GET['id']);
$eng = @array('my' => 'MySQL', 'pg' => 'Postgres', 'sl' => 'SQLite');
@sidu_sort($SIDU[5], $SIDU[6], $SIDU[7], $SIDU['page']['sortObj']);
$obj = @array("r" => @lang(1416), "v" => @lang(1417), "S" => @lang(1418), "f" => @lang(1419));
if ($link[3] != '') {
if ($link[3] == 'r') {
echo "<a href='tab-new.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']},{$SIDU['5']},{$SIDU['6']}' onclick=\"xwin(this.href,700,500);return false\" ", @html_hkey("=", @lang(1401)), ">", @html_img('img/tool-add'), "</a>{$SIDU['sep']}";
}
if ($link[3] == 'r' || $link[3] == 'v') {
echo "<a href='#' ", @html_hkey("E", @lang(1402)), " onclick='dbexp(\"{$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']}\",\"objs[]\")'>", @html_img('img/tool-down'), $SIDU['page']['menuText'] ? @lang(1403) : "", "</a>";
}
if ($link[3] == 'r') {
echo " <a href='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']}' ", @html_hkey("I", @lang(1404)), " onclick='xwin(this.href);return false'>", @html_img('img/tool-imp'), $SIDU['page']['menuText'] ? @lang(1405) : "", "</a>";
}
if ($link[3] == 'r') {
echo " <a href='#' onclick=\"showHide('objTool')\" title='", @lang(1406), "'>", @html_img('img/tool-sys'), $SIDU['page']['menuText'] ? @lang(1407) : "", "</a>\n\t\t\t<a href='#' onclick=\"setv('objcmd','Empty');return (confirm('", @lang(1409), "') ? dataTab.submit() : false)\" ", @html_hkey("-", @lang(1410)), ">", @html_img('img/tool-flush'), $SIDU['page']['menuText'] ? @lang(1408) : "", "</a>";
}
echo " <a href='#' onclick=\"setv('objcmd','Drop'); return (confirm('", @lang(1412, $obj[$SIDU[3]]), "') ? dataTab.submit() : false)\" ", @html_hkey("X", @lang(1413)), ">", @html_img('img/tool-x'), $SIDU['page']['menuText'] ? @lang(1411) : "", "</a>\n\t\t\t<a href='" . ($conn[1] == "sl" ? "tab.php?id={$SIDU['0']},{$SIDU['1']},0,r,sqlite_master'" : "#' onclick=\"showHide('DBseek')\"") . " ", @html_hkey("F", @lang(1414)), ">", @html_img('img/tool-find'), $SIDU['page']['menuText'] ? @lang(1415) : "", "</a>{$SIDU['sep']}", @html_img("img/x{$link['3']}"), " <a href='db.php?id={$link['0']},{$link['1']},,,,{$SIDU['5']},{$SIDU['6']}'>{$link['1']}</a>", $link[2] ? " » <a href='db.php?id={$link['0']},{$link['1']},{$link['2']},{$link['3']},,{$SIDU['5']},{$SIDU['6']}'>{$link['2']}</a>" : "", $link[4] != '' ? " » {$link['4']}" : "";
} else {
if ($conn[1] == "my") {
$serv['server'] = @mysql_get_server_info();
} elseif ($conn[1] == "pg") {
$serv = @pg_version();
} else {
$serv['server'] = @sqlite_libversion();
}
echo @html_img("img/eng-{$conn['1']}"), " <b>SIDU 3.0</b> for <b>{$eng[$conn[1]]}</b>\n\t\t{$SIDU['sep']}<a href='" . ($conn[1] == "sl" ? "tab.php?id={$SIDU['0']},{$SIDU['1']},0,r,sqlite_master'" : "#' onclick=\"showHide('DBseek')\"") . " ", @html_hkey("F", @lang(1414)), @html_img('img/tool-find'), "</a>\n\t\t<a href='db.php?id={$link['0']},,,,,{$SIDU['5']},{$SIDU['6']}'><b>", $conn[1] == "sl" ? "SQLite" : "{$conn['3']}@{$conn['2']}", "</b></a> v {$serv['server']}\n\t\t{$SIDU['sep']} ", @date("Y-m-d H:i:s");
}
}
开发者ID:abdeljawwad,项目名称:sedr,代码行数:33,代码来源:db.php
示例5: castLink
public static function castLink($link, array $a, Stub $stub, $isNested)
{
$a['status'] = pg_connection_status($link);
$a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
$a['busy'] = pg_connection_busy($link);
$a['transaction'] = pg_transaction_status($link);
if (isset(self::$transactionStatus[$a['transaction']])) {
$a['transaction'] = new ConstStub(self::$transactionStatus[$a['transaction']], $a['transaction']);
}
$a['pid'] = pg_get_pid($link);
$a['last error'] = pg_last_error($link);
$a['last notice'] = pg_last_notice($link);
$a['host'] = pg_host($link);
$a['port'] = pg_port($link);
$a['dbname'] = pg_dbname($link);
$a['options'] = pg_options($link);
$a['version'] = pg_version($link);
foreach (self::$paramCodes as $v) {
if (false !== ($s = pg_parameter_status($link, $v))) {
$a['param'][$v] = $s;
}
}
$a['param']['client_encoding'] = pg_client_encoding($link);
$a['param'] = new EnumStub($a['param']);
return $a;
}
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:26,代码来源:PgSqlCaster.php
示例6: getDriver
/**
* Gets the name of the correct database driver to use. As a side effect,
* sets the platform.
* @param (return-by-ref) $description A description of the database and version
* @return The class name of the driver eg. Postgres84
* @return null if version is < 7.4
* @return -3 Database-specific failure
*/
function getDriver(&$description)
{
// If we're on a recent enough PHP 5, and against PostgreSQL 7.4 or
// higher, we don't need to query for the version. This gives a great
// speed up.
if (function_exists('pg_version')) {
$v = pg_version($this->conn->_connectionID);
if (isset($v['server'])) {
$version = $v['server'];
}
}
// If we didn't manage to get the version without a query, query...
if (!isset($version)) {
$adodb = new ADODB_base($this->conn);
$sql = "SELECT VERSION() AS version";
$field = $adodb->selectField($sql, 'version');
// Check the platform, if it's mingw, set it
if (preg_match('/ mingw /i', $field)) {
$this->platform = 'MINGW';
}
$params = explode(' ', $field);
if (!isset($params[1])) {
return -3;
}
$version = $params[1];
// eg. 8.4.4
}
$description = "PostgreSQL {$version}";
// Detect version and choose appropriate database driver
switch (substr($version, 0, 3)) {
case '8.4':
return 'Postgres';
break;
case '8.3':
return 'Postgres83';
break;
case '8.2':
return 'Postgres82';
break;
case '8.1':
return 'Postgres81';
break;
case '8.0':
case '7.5':
return 'Postgres80';
break;
case '7.4':
return 'Postgres74';
break;
}
/* All <7.4 versions are not supported */
// if major version is 7 or less and wasn't catch in the
// switch/case block, we have an unsupported version.
if ((int) substr($version, 0, 1) < 8) {
return null;
}
// If unknown version, then default to latest driver
return 'Postgres';
}
开发者ID:hardikk,项目名称:HNH,代码行数:67,代码来源:Connection.php
示例7: pgVersion
public static function pgVersion()
{
// pg_version is only defined in postgres 7.4 and later
if (function_exists('pg_version')) {
return pg_version(self::connection());
} else {
// 7.4 is pretty old so older versions probably
// won't support what we're looking for
return 0;
}
}
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:11,代码来源:db_pgsql.php
示例8: get_versions
public function get_versions()
{
$version['engine'] = 'PostgreSQL';
$version['client'] = 'N/A';
$version['server'] = 'N/A';
$version = array_merge($version, pg_version($this->_owner->connect_id));
if ($version['server'] == 'N/A') {
//pgsql not compiled into php
$version['server'] = pg_parameter_status('server_version');
//pgsql 7.4+
}
return $version;
}
开发者ID:cbsistem,项目名称:nexos,代码行数:13,代码来源:postgresql.php
示例9: version
public static function version($mode = 'server')
{
if (array_key_exists('version', self::$dbProperties)) {
return self::$dbProperties['version'];
} else {
self::$dbProperties['version'] = pg_version();
if ($mode == 'server') {
return self::$dbProperties['version']['server'];
} else {
return self::$dbProperties['version']['client'];
}
}
}
开发者ID:webhacking,项目名称:Textcube,代码行数:13,代码来源:Adapter.php
示例10: getDatabaseVersion
public function getDatabaseVersion($databaseConfig)
{
$conn = $this->createConnection($databaseConfig, $error);
if (!$conn) {
return false;
} elseif ($conn instanceof PDO) {
return $conn->getAttribute(PDO::ATTR_SERVER_VERSION);
} elseif (is_resource($conn)) {
$info = pg_version($conn);
return $info['server'];
} else {
return false;
}
}
开发者ID:helpfulrobot,项目名称:silverstripe-postgresql,代码行数:14,代码来源:PostgreSQLDatabaseConfigurationHelper.php
示例11: dbVersion
/**
* Database Engine detection
* @return string the database versin
*/
public static function dbVersion()
{
$profile = jDb::getProfile();
//@TODO get the current dbLink to give it to each RDBMS function
/*
$tools = jDb::getTools();
$version = $tools->dbVersion();*/
if ($profile['driver'] == 'pgsql') {
$version = pg_version();
} elseif ($profile['driver'] == 'mysql') {
$version = mysql_get_server_info();
} elseif ($profile['driver'] == 'sqlite') {
$version = sqlite_version();
}
return $profile['driver'] . ' ' . $version;
}
开发者ID:havefnubb,项目名称:havefnubb,代码行数:20,代码来源:serverinfos.class.php
示例12: Open
/**
* 连接数据库
* @param array $array 数据库连接配置
* $array=array(
* 'pgsql_server',
* 'pgsql_username',
* 'pgsql_password',
* 'pgsql_name',
* 'pgsql_pre',
* 'pgsql_port',
* 'persistent')
* )
* @return bool
*/
public function Open($array)
{
$s = "host={$array[0]} port={$array[5]} dbname={$array[3]} user={$array[1]} password={$array[2]} options='--client_encoding=UTF8'";
if (false == $array[5]) {
$db_link = pg_connect($s);
} else {
$db_link = pg_pconnect($s);
}
if (!$db_link) {
return false;
} else {
$this->dbpre = $array[4];
$this->db = $db_link;
$v = pg_version($db_link);
$this->version = $v['client'];
return true;
}
}
开发者ID:zblogcn,项目名称:zblogphp,代码行数:32,代码来源:dbpgsql.php
示例13: __construct
/**
* Db_Pgsql constructor.
*
* @param array $args
* @throws \Exception
*/
public function __construct(array $args)
{
$this->args = $args;
if (!is_callable('pgsql_connect')) {
throw new \Exception(__METHOD__ . ': pgsql_connect is not supported.');
}
$this->conn = pg_connect(sprintf('host=%s user=%s password=%s dbname=%s', $args['host'], $args['user'], $args['pass'], $args['name']));
if ($this->conn === false) {
throw new \Exception(__METHOD__ . ': failed to connect to PostgreSQL server.');
}
$version = pg_version($this->conn);
if (is_array($version) && isset($version['server'])) {
$this->serverVersion = $this->getIntVersion($version['server']);
} else {
$this->serverVersion = 0;
}
if (!empty($args['charset'])) {
pg_set_client_encoding($this->conn, $args['charset']);
}
}
开发者ID:mystralkk,项目名称:geeklog,代码行数:26,代码来源:pgsql.class.php
示例14: connect
public function connect($dbIP, $dbUser, $dbPass, $dbName, $dbPort = null)
{
// check parameters
if ($dbIP == '') {
die('<b>ERROR:</b> no database host provided... <b>w2db.php, line ' . __LINE__ . '</b>');
}
if ($dbName == '') {
die('<b>ERROR:</b> no database name provided... <b>w2db.php, line ' . __LINE__ . '</b>');
}
if ($dbUser == '') {
die('<b>ERROR:</b> no database user provided... <b>w2db.php, line ' . __LINE__ . '</b>');
}
//if ($dbPass == '') die('no database password provided');
$this->dbName = $dbName;
// connect
if ($this->dbType == 'postgres') {
$this->dbConn = pg_connect("host={$dbIP} " . ($dbPort != null ? "port={$dbPort} " : "") . "dbname={$dbName} user={$dbUser} password={$dbPass}");
if (!$this->dbConn) {
$this->dbConn = null;
print "<b>ERROR:</b> Cannot connect to postgres.<br>";
return false;
}
$this->dbVersion = pg_version($this->dbConn);
$this->dbVersion['host'] = pg_host($this->dbConn);
}
if ($this->dbType == 'mysql') {
$this->dbConn = mysql_connect($dbIP . ($dbPort != null ? ":" . $dbPort : ""), $dbUser, $dbPass);
if (!$this->dbConn) {
$this->dbConn = null;
print "<b>ERROR:</b> Cannot connect to mysql.<br>";
return false;
}
mysql_select_db($dbName);
$this->dbVersion = array();
$this->dbVersion['client'] = mysql_get_client_info();
$this->dbVersion['protocol'] = mysql_get_proto_info($this->dbConn);
$this->dbVersion['server'] = mysql_get_server_info($this->dbConn);
$this->dbVersion['host'] = mysql_get_host_info($this->dbConn);
}
}
开发者ID:LeisureLeo,项目名称:w2ui,代码行数:40,代码来源:w2db.php
示例15: connect
/**
+----------------------------------------------------------
* 连接数据库方法
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function connect($config = '', $linkNum = 0)
{
if (!isset($this->linkID[$linkNum])) {
if (empty($config)) {
$config = $this->config;
}
$conn = $this->pconnect ? 'pg_pconnect' : 'pg_connect';
$this->linkID[$linkNum] = $conn('host=' . $config['hostname'] . ' port=' . $config['hostport'] . ' dbname=' . $config['database'] . ' user=' . $config['username'] . ' password=' . $config['password']);
if (pg_connection_status($this->linkID[$linkNum]) !== 0) {
throw_exception($this->error(false));
}
$pgInfo = pg_version($this->linkID[$linkNum]);
$this->dbVersion = $pgInfo['server'];
// 标记连接成功
$this->connected = true;
//注销数据库安全信息
if (1 != C('DB_DEPLOY_TYPE')) {
unset($this->config);
}
}
return $this->linkID[$linkNum];
}
开发者ID:dalinhuang,项目名称:concourse,代码行数:31,代码来源:DbPgsql.class.php
示例16: get_versions
function get_versions()
{
$version['engine'] = 'PostgreSQL';
$version['client'] = 'N/A';
$version['server'] = 'N/A';
if (function_exists('pg_version')) {
//php5+
$version = array_merge($version, pg_version($this->_owner->connect_id));
if ($version['server'] == 'N/A') {
//pgsql not compiled into php
$version['server'] = pg_parameter_status('server_version');
//pgsql 7.4+
}
} else {
if ($result = pg_query($this->_owner->connect_id, 'SELECT VERSION()')) {
list($v) = pg_fetch_row($result);
pg_free_result($result);
if (!empty($v)) {
$version['server'] = preg_replace('#PostgreSQL ([0-9\\.]+).*#i', '\\1', $v);
}
}
}
return $version;
}
开发者ID:cbsistem,项目名称:nexos,代码行数:24,代码来源:postgresql_mngr.php
示例17: getDatabaseVersion
public function getDatabaseVersion($databaseConfig)
{
$version = 0;
$username = $databaseConfig['username'] ? $databaseConfig['username'] : '';
$password = $databaseConfig['password'] ? $databaseConfig['password'] : '';
$server = $databaseConfig['server'];
$userPart = $username ? " user={$username}" : '';
$passwordPart = $password ? " password={$password}" : '';
$connstring = "host={$server} port=5432 dbname=postgres {$userPart}{$passwordPart}";
$conn = @pg_connect($connstring);
$info = @pg_version($conn);
$version = $info && isset($info['server']) ? $info['server'] : null;
if (!$version) {
// fallback to using the version() function
$result = @pg_query($conn, "SELECT version()");
$row = @pg_fetch_array($result);
if ($row && isset($row[0])) {
$parts = explode(' ', trim($row[0]));
// ASSUMPTION version number is the second part e.g. "PostgreSQL 8.4.3"
$version = trim($parts[1]);
}
}
return $version;
}
开发者ID:robert-h-curry,项目名称:silverstripe-postgresql,代码行数:24,代码来源:PostgreSQLDatabaseConfigurationHelper.php
示例18: insert_id
/**
* Insert ID
*
* @return string
*/
public function insert_id()
{
$v = pg_version($this->conn_id);
$v = isset($v['server']) ? $v['server'] : 0;
// 'server' key is only available since PosgreSQL 7.4
$table = func_num_args() > 0 ? func_get_arg(0) : NULL;
$column = func_num_args() > 1 ? func_get_arg(1) : NULL;
if ($table === NULL && $v >= '8.1') {
$sql = 'SELECT LASTVAL() AS ins_id';
} elseif ($table !== NULL) {
if ($column !== NULL && $v >= '8.0') {
$sql = 'SELECT pg_get_serial_sequence(\'' . $table . "', '" . $column . "') AS seq";
$query = $this->query($sql);
$query = $query->row();
$seq = $query->seq;
} else {
// seq_name passed in table parameter
$seq = $table;
}
$sql = 'SELECT CURRVAL(\'' . $seq . "') AS ins_id";
} else {
return pg_last_oid($this->result_id);
}
$query = $this->query($sql);
$query = $query->row();
return (int) $query->ins_id;
}
开发者ID:jimok82,项目名称:CIOpenReview,代码行数:32,代码来源:postgre_driver.php
示例19: _check
/**
* checks the environment
*
* @return array with success/failure values for the given attributes
*
*/
private function _check()
{
foreach ($this->values as $key => $value) {
if ($value['tag'] == 'ENVIROMENT') {
switch ($value['attributes']['NAME']) {
case 'Zend':
$required = $value['attributes']['VERSION'];
$zend = Zend_Version::VERSION;
$operator = $value['attributes']['OPERATOR'] == 'biggerThan' ? '>' : '<';
$text = $value['attributes']['NAME'] . ' ' . $operator . ' ' . $required;
if (version_compare($zend, $required, $operator)) {
$data[] = array($text, 'SUCCESS');
} else {
$data[] = array($text . ' (version is ' . $zend . ')', 'FAILURE');
}
break;
case 'PHP':
if (version_compare($value['attributes']['VERSION'], phpversion(), '<=')) {
$data[] = array($value['attributes']['NAME'], 'SUCCESS');
} else {
Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' PHP version incompatible: ' . phpversion() . ' < ' . $value['attributes']['VERSION']);
$data[] = array($value['attributes']['NAME'], 'FAILURE');
}
break;
case 'MySQL':
// get setup controller for database connection
if (Setup_Core::configFileExists()) {
$dbConfig = Tinebase_Core::getConfig()->database;
$hostnameWithPort = isset($dbConfig->port) ? $dbConfig->host . ':' . $dbConfig->port : $dbConfig->host;
$link = @mysql_connect($hostnameWithPort, $dbConfig->username, $dbConfig->password);
if (!$link) {
//die('Could not connect to mysql database: ' . mysql_error());
Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . 'Could not connect to mysql database: ' . mysql_error());
Setup_Core::set(Setup_Core::CHECKDB, FALSE);
}
$mysqlVersion = @mysql_get_server_info();
} else {
$mysqlVersion = @mysql_get_client_info();
}
// some version strings have more than just the version
preg_match('/\\d+\\.\\d+\\.\\d+/', $mysqlVersion, $matches);
$mysqlVersion = is_array($matches) ? $matches[0] : $mysqlVersion;
$text = $value['attributes']['NAME'];
if (version_compare($value['attributes']['VERSION'], $mysqlVersion, '<=')) {
$data[] = array($text, 'SUCCESS');
} else {
Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' MySQL version incompatible: ' . $mysqlVersion . ' < ' . $value['attributes']['VERSION']);
$data[] = array($text, 'FAILURE');
}
break;
case 'PgSQL':
$pgsqlVersion = '0.0.0';
// get setup controller for database connection
if (Setup_Core::configFileExists()) {
$dbConfig = Tinebase_Core::getConfig()->database;
$hostname = $dbConfig->host;
$port = isset($dbConfig->port) ? $dbConfig->port : '5432';
$user = $dbConfig->username;
$password = $dbConfig->password;
$link = @pg_connect("host={$hostname} port={$port} user={$user} password={$password}");
if (PGSQL_CONNECTION_BAD === pg_connection_status($link)) {
//die('Could not connect to postgresql database: ' . pg_errormessage());
Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . 'Could not connect to postgresql database: ' . pg_errormessage());
Setup_Core::set(Setup_Core::CHECKDB, FALSE);
} else {
$pgsqlVersion = @pg_version($link);
$pgsqlVersion = $pgsqlVersion['server'];
}
}
$text = $value['attributes']['NAME'];
if (version_compare($value['attributes']['VERSION'], $pgsqlVersion, '<=')) {
$data[] = array($text, 'SUCCESS');
} else {
Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' PostgreSQL version incompatible: ' . $pgsqlVersion . ' < ' . $value['attributes']['VERSION']);
$data[] = array($text, 'FAILURE');
}
break;
default:
$data[] = array($value['attributes']['NAME'], 'FAILURE');
break;
}
} else {
if ($value['tag'] == 'EXTENSION') {
//print_r($this->loadedExtensions);
foreach ($value as $extensionArray) {
if (is_array($extensionArray)) {
$succeeded = false;
if (in_array($extensionArray['NAME'], $this->loadedExtensions)) {
$passed[] = true;
if ($this->values[$key + 1]['tag'] == 'INISET') {
$iniSettings = ini_get_all($extensionArray['NAME']);
//print_r($iniSettings);
$i = 1;
while ($values[$key + $i]['tag'] == 'INISET') {
//.........这里部分代码省略.........
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:101,代码来源:ExtCheck.php
示例20: print_row
}
print_row("PEAR::MDB2#mysql", $result, $status);
}
//Database Version
if (isset($maia_sql_dsn)) {
if (preg_match('/^mysqli/', $maia_sql_dsn)) {
$db_version = mysqli_get_server_info($test_dbh->connection);
$status = OK;
$result = "No minimum specified yet... Installed: " . $db_version;
} elseif (preg_match('/^mysql/', $maia_sql_dsn)) {
$db_version = mysql_get_server_info($test_dbh->connection);
$status = OK;
$result = "No minimum specified yet... Installed: " . $db_version;
} elseif (preg_match('/^pgsql/', $maia_sql_dsn)) {
if (function_exists("pg_version")) {
$pg_version_result = pg_version($test_dbh->connection);
$db_version = $pg_version_result['server'];
if ($db_version >= "8.0") {
$status = OK;
$result = "Database version: " . $db_version;
} else {
$status = ERROR;
$result = "Postgresql >= 8.0 required.";
}
} else {
$status = WARN;
$result = "Cannot determine database version. We recommend Postgresql > 8.0; Please verify this before continuing.";
}
} else {
$status = ERROR;
$result = "Unsupported database";
开发者ID:tenshi3,项目名称:maia_mailguard,代码行数:31,代码来源:configtest.php
注:本文中的pg_version函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论