diff --git a/libraries/classes/Controllers/Table/TableSearchController.php b/libraries/classes/Controllers/Table/TableSearchController.php index 9162fa4339..9b79d46753 100644 --- a/libraries/classes/Controllers/Table/TableSearchController.php +++ b/libraries/classes/Controllers/Table/TableSearchController.php @@ -1020,7 +1020,10 @@ class TableSearchController extends TableController $geom_funcs = Util::getGISFunctions($types, true, false); // If the function takes multiple parameters - if ($geom_funcs[$geom_func]['params'] > 1) { + if(strpos($func_type, "IS NULL") !== false || strpos($func_type, "IS NOT NULL") !== false) { + $where = Util::backquote($names) . " " . $func_type; + return $where; + } elseif ($geom_funcs[$geom_func]['params'] > 1) { // create gis data from the criteria input $gis_data = Util::createGISData($criteriaValues); $where = $geom_func . '(' . Util::backquote($names) diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index b97c7bfb7e..eceebadaa8 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -1678,6 +1678,11 @@ class Results */ private function _getOptionsBlock() { + if(isset($_SESSION['tmpval']['possible_as_geometry']) && $_SESSION['tmpval']['possible_as_geometry'] == false) { + if($_SESSION['tmpval']['geoOption'] == self::GEOMETRY_DISP_GEOM) { + $_SESSION['tmpval']['geoOption'] = self::GEOMETRY_DISP_WKT; + } + } return Template::get('display/results/options_block')->render([ 'unique_id' => $this->__get('unique_id'), 'geo_option' => $_SESSION['tmpval']['geoOption'], @@ -1687,6 +1692,7 @@ class Results 'relational_display' => $_SESSION['tmpval']['relational_display'], 'displaywork' => $GLOBALS['cfgRelation']['displaywork'], 'relwork' => $GLOBALS['cfgRelation']['relwork'], + 'possible_as_geometry' => $_SESSION['tmpval']['possible_as_geometry'], 'pftext' => $_SESSION['tmpval']['pftext'], 'db' => $this->__get('db'), 'table' => $this->__get('table'), diff --git a/libraries/classes/Sql.php b/libraries/classes/Sql.php index f3c40b6001..0933446fd3 100644 --- a/libraries/classes/Sql.php +++ b/libraries/classes/Sql.php @@ -1941,6 +1941,8 @@ EOT; || $updatableView) && $just_one_table; + $_SESSION['tmpval']['possible_as_geometry'] = $editable; + $displayParts = array( 'edit_lnk' => $displayResultsObject::UPDATE_ROW, 'del_lnk' => $displayResultsObject::DELETE_ROW, diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 661b72d87e..192695dbdc 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -2980,7 +2980,7 @@ class Util } $wktresult = $GLOBALS['dbi']->tryQuery( - $wktsql, null, DatabaseInterface::QUERY_STORE + $wktsql ); $wktarr = $GLOBALS['dbi']->fetchRow($wktresult, 0); $wktval = $wktarr[0]; diff --git a/templates/display/results/options_block.twig b/templates/display/results/options_block.twig index b713616ccb..465f9e3467 100644 --- a/templates/display/results/options_block.twig +++ b/templates/display/results/options_block.twig @@ -73,22 +73,40 @@ } only %} -
- {{ Util_getRadioFields( - 'geoOption', - { - 'GEOM': 'Geometry'|trans, - 'WKT': 'Well Known Text'|trans, - 'WKB': 'Well Known Binary'|trans - }, - geo_option, - true, - true, - '', - 'geoOption_' ~ unique_id - ) }} -
+ {% if possible_as_geometry %} +
+ {{ Util_getRadioFields( + 'geoOption', + { + 'GEOM': 'Geometry'|trans, + 'WKT': 'Well Known Text'|trans, + 'WKB': 'Well Known Binary'|trans + }, + geo_option, + true, + true, + '', + 'geoOption_' ~ unique_id + ) }} +
+ {% else %} +
+ {{ possible_as_geometry }} + {{ Util_getRadioFields( + 'geoOption', + { + 'WKT': 'Well Known Text'|trans, + 'WKB': 'Well Known Binary'|trans + }, + geo_option, + true, + true, + '', + 'geoOption_' ~ unique_id + ) }} +
+ {% endif %}
diff --git a/test/classes/Controllers/Table/TableSearchControllerTest.php b/test/classes/Controllers/Table/TableSearchControllerTest.php index 254ff2b8d9..dfbf8f15fc 100644 --- a/test/classes/Controllers/Table/TableSearchControllerTest.php +++ b/test/classes/Controllers/Table/TableSearchControllerTest.php @@ -319,7 +319,7 @@ class TableSearchControllerTest extends PmaTestCase 'b', 'a' ); $_POST['criteriaColumnOperators'] = array( - '<=', '=' + '<=', '=', 'IS NULL', 'IS NOT NULL' ); $_POST['criteriaValues'] = array( '10', '2'