]> git.joonet.de Git - adminer.git/commitdiff
Support JSON since MariaDB 10.2 (bug #590)
authorJakub Vrana <jakub@vrana.cz>
Mon, 29 Jan 2018 20:08:38 +0000 (21:08 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 29 Jan 2018 20:08:38 +0000 (21:08 +0100)
adminer/drivers/mysql.inc.php
adminer/drivers/pgsql.inc.php
adminer/include/functions.inc.php
changes.txt

index 4ed06b05e4b4e93880c58b9402ad4e2981258e8e..6504536cdbb0b4a4590edd6acca5440bbb7d9a19 100644 (file)
@@ -307,7 +307,7 @@ if (!defined("DRIVER")) {
                if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
                        $connection->set_charset(charset($connection)); // available in MySQLi since PHP 5.0.5
                        $connection->query("SET sql_quote_show_create = 1, autocommit = 1");
-                       if (version_compare($connection->server_info, '5.7.8') >= 0) {
+                       if (min_version('5.7.8', 10.2, $connection) >= 0) {
                                $structured_types[lang('Strings')][] = "json";
                                $types["json"] = 4294967295;
                        }
index 78c7183372e7594d7fb6f27b2d0871a160cf4933..793a02ff1a5ed42de814c6028f0596d883fa13ee 100644 (file)
@@ -190,12 +190,12 @@ if (isset($_GET["pgsql"])) {
                $connection = new Min_DB;
                $credentials = $adminer->credentials();
                if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
-                       if ($connection->server_info >= 9) {
+                       if (min_version(9, 0, $connection)) {
                                $connection->query("SET application_name = 'Adminer'");
-                               if ($connection->server_info >= 9.2) {
+                               if (min_version(9.2, 0, $connection)) {
                                        $structured_types[lang('Strings')][] = "json";
                                        $types["json"] = 4294967295;
-                                       if ($connection->server_info >= 9.4) {
+                                       if (min_version(9.4, 0, $connection)) {
                                                $structured_types[lang('Strings')][] = "jsonb";
                                                $types["jsonb"] = 4294967295;
                                        }
index 607a56e557fef634a29a97fa2c3e9cbc7d28ed1a..062cee3c2db4def5e6d78e6025b578d2947489d3 100644 (file)
@@ -76,11 +76,15 @@ function bracket_escape($idf, $back = false) {
 /** Check if connection has at least the given version
 * @param string required version
 * @param string required MariaDB version
+* @param Min_DB defaults to $connection
 * @return bool
 */
-function min_version($version, $maria_db = "") {
+function min_version($version, $maria_db = "", $connection2 = null) {
        global $connection;
-       $server_info = $connection->server_info;
+       if (!$connection2) {
+               $connection2 = $connection;
+       }
+       $server_info = $connection2->server_info;
        if ($maria_db && preg_match('~([\d.]+)-MariaDB~', $server_info, $match)) {
                $server_info = $match[1];
                $version = $maria_db;
index 6b658061bbf947a4d92b588492dabb0cd8085ffe..b506045ff0d13fdfc08cb4d22c5bfe47f8823b95 100644 (file)
@@ -1,6 +1,7 @@
 Adminer 4.5.1-dev:
 Fix counting selected rows after going back to select page
 PHP <5.3 compatibility even with Elasticsearch enabled
+MariaDB: Support JSON since MariaDB 10.2
 Malay translation
 
 Adminer 4.5.0 (released 2018-01-24):