[gdal-dev] OGR dynamic query
Frank Warmerdam
warmerdam at pobox.com
Mon Sep 22 10:46:35 EDT 2008
Frédéric Therrien wrote:
> Hey guys, I'm using ogr to perform select statement in a database for a
> mapserver/gis. I would like to know something. Is it possible to build
> dynamic query ? Here is an example:
>
> Select * from Table where field1 > X
>
> Where X can vary depending on the query. I would like to use this
> feature for time display (display information since a date and this date
> can be feed by the user in the user interface).
>
> Thx for you help.
Frédéric,
I don't know anything about your application, but of course it is
generally possible to do dynamic queries. This would normally be
accomplished by assembling the query string dynamically in your
application before passing it to ExecuteSQL() or SetAttributeFilter().
Note that "OGR SQL" requires that the right side of any comparison be
a constant, so you can't compare two fields in a non-database datasource
(if that is what you were thinking). You can do anything supported by
SQL in a real RDBMS.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list