[gdal-dev] sqlite dialect and MySQL spatial input

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Mon Sep 30 07:40:05 PDT 2013


aborruso <aborruso <at> gmail.com> writes:

> 
> Only to add that if I try to read the same MySQL input using OGR Virtual
> Format, the ST_Area function works properly.
> 
> Thank you

Hi,

http://www.gdal.org/ogr/ogr_sql.html says:
"All OGR drivers for database systems: MySQL, PostgreSQL and PostGIS (PG),
Oracle (OCI), SQLite, ODBC, ESRI Personal Geodatabase (PGeo) and MS SQL
Spatial (MSSQLSpatial), override the OGRDataSource::ExecuteSQL() function
with dedicated implementation and, by default, pass the SQL statements
directly to the underlying RDBMS. In these cases the SQL syntax varies in
some particulars from OGR SQL. Also, anything possible in SQL can then be
accomplished for these particular databases. Only the result of SQL WHERE
statements will be returned as layers."

On the other hand, SQLite dialect page tells us

"The SQLite dialect may be used with any OGR datasource, like the OGR SQL
dialect. It is available through the OGRDataSource::ExecuteSQL() method by
specifying the pszDialect to "SQLITE". For the ogrinfo or ogr2ogr utility,
you must specify the "-dialect SQLITE" option."

As a user I think that most logical would be if SQLite dialect override
really works in a similar way for all OGR datasources. Obviously it does not
but you have found an undocumented workaround by using VRT. I wonder where
in the documentation would be the best place to mention this over-override
trick.

-Jukka Rahkonen





More information about the gdal-dev mailing list