]> git.joonet.de Git - adminer.git/commitdiff
MySQL: Display converting function for binary, bit or geometry fields
authorJakub Vrana <jakub@vrana.cz>
Thu, 13 Mar 2025 06:50:20 +0000 (07:50 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 13 Mar 2025 06:50:20 +0000 (07:50 +0100)
adminer/drivers/mysql.inc.php
adminer/include/driver.inc.php
adminer/include/functions.inc.php
changes.txt
externals/jush

index e395e4def8b8e868ec2677c0bbb4810542cbcda4..a563eca6e9b9571c84f1994cf1f58fe132a2d531 100644 (file)
@@ -330,6 +330,13 @@ if (!defined('Adminer\DRIVER')) {
                        }
                }
 
+               function unconvertFunction($field) {
+                       return (preg_match("~binary~", $field["type"]) ? "<code class='jush-sql'>UNHEX</code>"
+                               : ($field["type"] == "bit" ? doc_link(array('sql' => 'bit-value-literals.html'), "<code>b''</code>")
+                               : (preg_match("~geometry|point|linestring|polygon~", $field["type"]) ? "<code class='jush-sql'>GeomFromText</code>"
+                               : "")));
+               }
+
                function insert($table, $set) {
                        return ($set ? parent::insert($table, $set) : queries("INSERT INTO " . table($table) . " ()\nVALUES ()"));
                }
index 175b5f8054b68eafe55bcd75f77cb5a73f201192..ae9289cf4670b5cc0ec7517e015090540f2f08b6 100644 (file)
@@ -66,6 +66,13 @@ abstract class SqlDriver {
        function enumLength($field) {
        }
 
+       /** Function used to convert the value inputted by user
+       * @param array
+       * @return string or null
+       */
+       function unconvertFunction($field) {
+       }
+
        /** Select data from table
        * @param string
        * @param array result of $adminer->selectColumnsProcess()[0]
index 1fa23657193ec1754e6d2670dc40457b75667607..8d8138bf84fd20d21cfd2d25ac78e93e3f0f1b02 100644 (file)
@@ -934,6 +934,7 @@ function input($field, $value, $function) {
                $field["type"] = "enum";
                $field["length"] = $enums;
        }
+       echo $driver->unconvertFunction($field) . " ";
        if ($field["type"] == "enum") {
                echo h($functions[""]) . "<td>" . $adminer->editInput($_GET["edit"], $field, $attrs, $value);
        } else {
index 4b632f1e2b23f7050eb9d8778ac6efaae4883f4e..7d763c6b0ed1fc441f9643d72aa60821b7a4f69d 100644 (file)
@@ -1,4 +1,5 @@
 Adminer dev:
+MySQL: Display converting function for binary, bit or geometry fields
 MySQL: Display default values of binary columns
 MySQL: Allow setting default values of json column
 MariaDB: Don't display NULL as default value (regression from 5.0.0)
index 792086f0fd28a5fda161b4b669485d3bf3ea37ff..e095c0d590d2e228f989739c6bcb206b54168c07 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 792086f0fd28a5fda161b4b669485d3bf3ea37ff
+Subproject commit e095c0d590d2e228f989739c6bcb206b54168c07