mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 06:46:00 +00:00
map - show geometry in MySQL
This commit is contained in:
@@ -2,6 +2,18 @@ const { driverBase } = global.DBGATE_TOOLS;
|
||||
const { mysqlSplitterOptions } = require('dbgate-query-splitter/lib/options');
|
||||
const Dumper = require('./Dumper');
|
||||
|
||||
const spatialTypes = [
|
||||
'POINT',
|
||||
'LINESTRING',
|
||||
'POLYGON',
|
||||
'GEOMETRY',
|
||||
'MULTIPOINT',
|
||||
'MULTILINESTRING',
|
||||
'MULTIPOLYGON',
|
||||
'GEOMCOLLECTION',
|
||||
'GEOMETRYCOLLECTION',
|
||||
];
|
||||
|
||||
/** @type {import('dbgate-types').SqlDialect} */
|
||||
const dialect = {
|
||||
rangeSelect: true,
|
||||
@@ -68,6 +80,23 @@ const dialect = {
|
||||
'time',
|
||||
'year',
|
||||
],
|
||||
|
||||
createColumnViewExpression(columnName, dataType, source, alias) {
|
||||
if (dataType && spatialTypes.includes(dataType.toUpperCase())) {
|
||||
return {
|
||||
exprType: 'call',
|
||||
func: 'ST_AsText',
|
||||
alias: alias || columnName,
|
||||
args: [
|
||||
{
|
||||
exprType: 'column',
|
||||
columnName,
|
||||
source,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const mysqlDriverBase = {
|
||||
|
||||
Reference in New Issue
Block a user