[gdal-dev] Change in parsing of OGR where clause

Andrew Bell andrew.bell.ia at gmail.com
Wed Apr 6 13:48:38 PDT 2016


On Wed, Apr 6, 2016 at 3:39 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> Andrew,
>
> > In version 1.X of GDAL, the following was accepted and worked:
> >
> > std::string query = "LOCATION=\"some text\"";
> > OGR_L_SetAttributeFilter(layer, query.c_str());
> >
> > In version 2.X, this is no longer accepted and the double quotes must be
> > replaced by single quotes:
> >
> > std::string query = "LOCATION='some text'";
> > OGR_L_SetAttributeFilter(layer, query.c_str());
> >
> > This wouldn't be awful, but the error that occurs tells you nothing about
> > the actual problem.  It yields:
> >
> > "some text" not recognised as an available field.
>
> Well, I find the message quite clear : "some text" isn't an recognized
> field :-)
>

Is there a context where a double-quoted string would be acceptable here?
If so, then fine (maybe).  But if not, it seems that something like
"unexpected character '"' found in where clause" would make more sense than
the current message.

I will stop joking now :-) Here's what you want to read that should explain
> the rationale for this change :
> https://trac.osgeo.org/gdal/wiki/rfc52_strict_sql_quoting


I'm not grumbling about the change, but it took me a while to track down :(
  A different error message would have helped greatly.

Thanks,

-- 
Andrew Bell
andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160406/2eaadb49/attachment.html>


More information about the gdal-dev mailing list