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 :-) > > Perhaps it should give a parsing error? No, that's valid SQL. "some text" is a quoted identifier, that doesn't match any field of your layer. > In 1.11, parsing the query with > double quotes would yield an SNT_OPERATION node with subnodes SNT_COLUMN > and SNT_CONSTANT. In 2.0, the same query yields an SNT_OPERATION with two > SNT_COLUMN subnodes, which seems to cause the confusing error. > > Should the parser accept column values with double quotes? If not, can it > provide better feedback? 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 Best regards, Even -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
