Fix for issues with spatial fields (#14125)
* Fix for issues with spatial fields
Fixes the following issues:
1. #14068 SPATIAL fields with no unique index/autoincrement error when clicking
This error occurs when there is no unique column to uniquely identify a tuple. I've disabled the geomtery view and made view as wkt the default view in such cases.
2. #14121 View spatial fields as WKT doesn't work
1. #14067 IS NULL search operator produces no WHERE SQL with spatial fields
Signed-Off-By: Lakshay arora <arora.lakshya123@gmail.com>
* Fix for issues with spatial fields
This commit fixes view as BINARY not working in the previous commit.
Signed-Off-By: Lakshay arora <arora.lakshya123@gmail.com>
* Fix for issues with spatial fields
Fixes typo in previous commits.
Signed-Off-By: Lakshay arora <arora.lakshya123@gmail.com>
(cherry picked from commit 9231620c2d)
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
fe70b6669a
commit
0da5857b5d
@ -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)
|
||||
|
||||
@ -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'),
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -73,22 +73,40 @@
|
||||
} only %}
|
||||
</div>
|
||||
|
||||
<div class="formelement">
|
||||
{{ Util_getRadioFields(
|
||||
'geoOption',
|
||||
{
|
||||
'GEOM': 'Geometry'|trans,
|
||||
'WKT': 'Well Known Text'|trans,
|
||||
'WKB': 'Well Known Binary'|trans
|
||||
},
|
||||
geo_option,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'geoOption_' ~ unique_id
|
||||
) }}
|
||||
</div>
|
||||
|
||||
{% if possible_as_geometry %}
|
||||
<div class="formelement">
|
||||
{{ Util_getRadioFields(
|
||||
'geoOption',
|
||||
{
|
||||
'GEOM': 'Geometry'|trans,
|
||||
'WKT': 'Well Known Text'|trans,
|
||||
'WKB': 'Well Known Binary'|trans
|
||||
},
|
||||
geo_option,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'geoOption_' ~ unique_id
|
||||
) }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="formelement">
|
||||
{{ possible_as_geometry }}
|
||||
{{ Util_getRadioFields(
|
||||
'geoOption',
|
||||
{
|
||||
'WKT': 'Well Known Text'|trans,
|
||||
'WKB': 'Well Known Binary'|trans
|
||||
},
|
||||
geo_option,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'geoOption_' ~ unique_id
|
||||
) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="clearfloat"></div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ class TableSearchControllerTest extends PmaTestCase
|
||||
'b', 'a'
|
||||
);
|
||||
$_POST['criteriaColumnOperators'] = array(
|
||||
'<=', '='
|
||||
'<=', '=', 'IS NULL', 'IS NOT NULL'
|
||||
);
|
||||
$_POST['criteriaValues'] = array(
|
||||
'10', '2'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user