1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-18 12:21:24 +02:00

Move $enum_length to Driver

This commit is contained in:
Jakub Vrana
2025-03-06 14:51:24 +01:00
parent f711135574
commit c6f825a786
5 changed files with 7 additions and 8 deletions

View File

@@ -35,7 +35,7 @@ if ($_GET["script"] == "version") {
exit;
}
global $adminer, $connection, $driver, $drivers, $enum_length, $error, $HTTPS, $jush, $LANG, $langs, $permanent, $has_token, $token, $translations, $VERSION; // allows including Adminer inside a function
global $adminer, $connection, $driver, $drivers, $error, $HTTPS, $jush, $LANG, $langs, $permanent, $has_token, $token, $translations, $VERSION; // allows including Adminer inside a function
if (!$_SERVER["REQUEST_URI"]) { // IIS 5 compatibility
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"];

View File

@@ -35,6 +35,7 @@ abstract class SqlDriver {
var $grouping = array(); ///< @var array grouping functions used in select
var $onActions = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT"; ///< @var string used in foreign_keys()
var $inout = "IN|OUT|INOUT";
var $enumLength = "'(?:''|[^'\\\\]|\\\\.)*'";
/** Create object for performing database operations
* @param Db

View File

@@ -256,8 +256,8 @@ function get_partitions_info($table) {
* @return string
*/
function process_length($length) {
global $enum_length;
return (preg_match("~^\\s*\\(?\\s*$enum_length(?:\\s*,\\s*$enum_length)*+\\s*\\)?\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches)
global $driver;
return (preg_match("~^\\s*\\(?\\s*$driver->enumLength(?:\\s*,\\s*$enum_length)*+\\s*\\)?\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches)
? "(" . implode(",", $matches[0]) . ")"
: preg_replace('~^[0-9].*~', '(\0)', preg_replace('~[^-0-9,+()[\]]~', '', $length))
);