[gdal-dev] about OGRSQL case sensitive
梁天辰
2284168009 at qq.com
Thu Jun 13 00:46:16 PDT 2013
Hi all,
According to page http://www.gdal.org/ogr/ogr_sql.html , I found that <, >, <= and >= operators are case sensitive. My code is something like this: and I couldn't get the required result. Can anyone give me some suggestions?Thanks for your help!
OGRFeature *pfea = OGRFeature::CreateFeature(poLayerws->GetLayerDefn());
pfea->SetField("codede","CAPITAL");
if (poLayerws->CreateFeature(pfea) != OGRERR_NONE)
{
return false;
}
pfea = OGRFeature::CreateFeature(poLayerws->GetLayerDefn());
pfea->SetField("codede","capital");
if (poLayerws->CreateFeature(pfea) != OGRERR_NONE)
{
return false;
}
string layername = poLayerws->GetName();
string ssf = "SELECT * FROM " + layername + " WHERE codede >= 'capital' AND codede <= 'capital'" ;
const char *sql = ssf.c_str();
OGRLayer *ret = poDSws->ExecuteSQL(sql,NULL,NULL);
/*value of n is 2*/
int n = ret->GetFeatureCount();
ret->ResetReading();
OGRFeature *pfearet;
/*prints CAPITAL
capital*/
while(pfearet = ret->GetNextFeature())
{
cout<<pfearet->GetFieldAsString("codede")<<endl;
}
poDSws->ReleaseResultSet(ret);
OGRDataSource::DestroyDataSource(poDSws);
OGRCleanupAll();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130613/7d1655f6/attachment.html>
More information about the gdal-dev
mailing list