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.

Perhaps it should give a parsing error?  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?

-- 
Andrew Bell
[email protected]
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to