#2007 closed bug (fixed)
Query builders LIKE statement treats every string like '%string%' with DBF backend
Reported by: | marisn | Owned by: | nobody |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | |
Component: | Vectors | Version: | Trunk |
Keywords: | SQL | Cc: | |
Must Fix for Release: | No | Platform: | Gentoo |
Platform Version: | Awaiting user input: | yes |
Description
Steps to reproduce:
- Open Shapefile;
- Open attribute table;
- Open query builder;
- Create following query:
mycolumn LIKE 'A%'
- Test result.
Result set should contain only mycolumn entries that start with "A" letter, still they will contain also any entry that has "A" letter in it. Seems like "%" and "_" are ignored and string is allways treated like "%%" one.
I have no idea if it's only DBF related (limitation?) or not, but as queries in query builder return wrong data sets, something must be done to warn user about QGIS specific SQL dialect, if it's not possible to fix this issue.
Attachments (1)
Change History (7)
comment:1 by , 14 years ago
Awaiting user input: | set |
---|
comment:3 by , 14 years ago
Good news - it's NOT an GDAL/OGR bug but a QGIS bug :) Tested with 1.6.2 ogrinfo -where and -sql options - OGR returns correct results. QGIS 1.2.0 and current trunk - NOT correct results. I will attach sample dataset.
Steps to reproduce:
- Open file (UTF-8 coding);
- Open Attribute table;
- Advanced search;
- At SQL where clause enter following text:
NOSAUKUMS LIKE 'S%'
- Press OK.
I get 4 results - also "CESIS", still "CESIS" doesn't match 'S%' pattern.
comment:4 by , 14 years ago
With your sample data and you SQL clause I get 3 (correct) results, so I cannot confirm the problem.
Using qgis trunk compiled under Ubuntu 9.04
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 14 years ago
Thanks! Tested - now works just fine. Sorry for confusing description - at first I was using localised QGIS version and thus migh be calling things different than en_US version does :)
not reproducable here. QGIS uses OGR to access shapefiles and uses OGR SQL to query OGR layers. So this might be a GDAL issue. Which version are you using?