Merge #16391 - Fix #16326 - Latitude and Longitudes swap for geometries in edit mode

Fixes: #16326
Pull-request: #16391

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-10-13 13:43:11 +02:00
commit 711095d4cc
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 50 additions and 3 deletions

View File

@ -3093,11 +3093,18 @@ class Util
$hex = bin2hex($data);
$spatialAsText = 'ASTEXT';
$spatialSrid = 'SRID';
if ($GLOBALS['dbi']->getVersion() >= 50600) {
$axisOrder = '';
$mysqlVersionInt = $GLOBALS['dbi']->getVersion();
if ($mysqlVersionInt >= 50600) {
$spatialAsText = 'ST_ASTEXT';
$spatialSrid = 'ST_SRID';
}
$wktsql = "SELECT $spatialAsText(x'" . $hex . "')";
if ($mysqlVersionInt >= 80010 && ! $GLOBALS['dbi']->isMariaDb()) {
$axisOrder = ', \'axis-order=long-lat\'';
}
$wktsql = 'SELECT ' . $spatialAsText . "(x'" . $hex . "'" . $axisOrder . ")";
if ($includeSRID) {
$wktsql .= ", $spatialSrid(x'" . $hex . "')";
}

View File

@ -2948,6 +2948,46 @@ class UtilTest extends PmaTestCase
true,
50700,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\', \'axis-order=long-lat\'), ST_SRID(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'\'POINT(1 1)\',0',
true,
80010,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\'), ST_SRID(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'\'POINT(1 1)\',0',
true,
50700,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\', \'axis-order=long-lat\')',
[
'POINT(1 1)',
'0',
],
'POINT(1 1)',
false,
80010,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'POINT(1 1)',
false,
50700,
],
];
}
@ -2959,7 +2999,7 @@ class UtilTest extends PmaTestCase
* @param string $expectedQuery The query to expect
* @param array $returnData The data to return for fetchRow
* @param string $functionResult Result of the Util::asWKT invocation
* @param string $SRIDOption Use the SRID option or not
* @param bool $SRIDOption Use the SRID option or not
* @param int $mysqlVersion The mysql version to return for getVersion
*
* @return void