[geeklog-cvs] geeklog: Introduce DB_getVersion() to get the version of the dat...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Mar 13 16:00:52 EDT 2011
changeset 8160:88fcc6589db3
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/88fcc6589db3
user: Rouslan Placella <rouslan at placella.com>
date: Sun Mar 13 20:00:22 2011 +0000
description:
Introduce DB_getVersion() to get the version of the database server.
diffstat:
system/databases/mssql.class.php | 9 +++++++++
system/databases/mysql.class.php | 9 +++++++++
system/databases/pgsql.class.php | 10 ++++++++++
system/lib-database.php | 16 ++++++++++++++--
4 files changed, 42 insertions(+), 2 deletions(-)
diffs (96 lines):
diff -r 56ce21f3bedc -r 88fcc6589db3 system/databases/mssql.class.php
--- a/system/databases/mssql.class.php Sun Mar 13 20:33:42 2011 +0100
+++ b/system/databases/mssql.class.php Sun Mar 13 20:00:22 2011 +0000
@@ -1151,6 +1151,15 @@
}
}
+ /**
+ * @return string the version of the database application
+ */
+ function dbGetVersion()
+ {
+ $q = $this->dbQuery("SELECT SERVERPROPERTY('productversion')");
+ $v = $this->dbFetchArray($q, true);
+ return $v[0];
+ }
}//end class
diff -r 56ce21f3bedc -r 88fcc6589db3 system/databases/mysql.class.php
--- a/system/databases/mysql.class.php Sun Mar 13 20:33:42 2011 +0100
+++ b/system/databases/mysql.class.php Sun Mar 13 20:00:22 2011 +0000
@@ -749,6 +749,15 @@
$this->_errorlog("\n*** Leaving database->dbUnlockTable ***");
}
}
+
+ /**
+ * @return string the version of the database application
+ */
+ function dbGetVersion()
+ {
+ return @mysql_get_server_info();
+ }
+
}
?>
diff -r 56ce21f3bedc -r 88fcc6589db3 system/databases/pgsql.class.php
--- a/system/databases/pgsql.class.php Sun Mar 13 20:33:42 2011 +0100
+++ b/system/databases/pgsql.class.php Sun Mar 13 20:00:22 2011 +0000
@@ -884,6 +884,16 @@
return $this->_verbose;
}
+
+ /**
+ * @return string the version of the database application
+ */
+ function dbGetVersion()
+ {
+ $v = @pg_version($this->_db);
+ return $v['server'];
+ }
+
}
?>
diff -r 56ce21f3bedc -r 88fcc6589db3 system/lib-database.php
--- a/system/lib-database.php Sun Mar 13 20:33:42 2011 +0100
+++ b/system/lib-database.php Sun Mar 13 20:00:22 2011 +0000
@@ -287,7 +287,7 @@
* @param string $value_to_set Value to set abovle field to
* @param array|string $id field name(s) to use in where clause
* @param array|string $value Value(s) to use in where clause
-* @param string $return_page page to send user to when done with change
+* @param string $return_page page to send user to when done with change
* @param boolean $supress_quotes whether or not to use single quotes in where clause
*
*/
@@ -331,7 +331,7 @@
* @param string $fields Comma delmited list of fields to copy over
* @param string $values Values to store in database field
* @param string $tablefrom Table to get record from
-* @param array|string $id Field name(s) to use in where clause
+* @param array|string $id Field name(s) to use in where clause
* @param array|string $value Value(s) to use in where clause
* @param string $return_page Page to send user to when done
*
@@ -646,4 +646,16 @@
return $retArray;
}
+/**
+* @return string the version of the database server
+*/
+
+function DB_getVersion()
+{
+ global $_DB;
+
+ return $_DB->dbGetVersion();
+}
+
+
?>
More information about the geeklog-cvs
mailing list