TZQuery Filter with * problem
Posted: 30.03.2014, 11:26
Hello!
I noticed that using asterisk as filter works fine only when I use * at the end of fileterd string ie. 'Test*'
When I use asterisk at the beginning ie. '*test' or use two asteriscs in the filter reults are not intuitive.
I tested on firebird db and sqlite db. Lets create any db and a table TABLE with one column COLUMN and fill it with values (1,2,1150,4311). Lets connect to db using a query 'select COLUMN from TABLE'. I tested using Zeoslib 7.1.2 TZConnection and TZQuery. Let's put TDataSource and TDBGrid components on a form and fill the Filter property using: grid.DataSource.Dataset.Filter = '11*'. The result will be correct: 1150. But when you put two wildcards '*11*' or put wildcard on the beginning of the string the result will be wrong: (1,2,1150,1143) instead of (1150, 1143).
I worked with Lazarus 0.9.3, 1.0, 1.1.99-pre, 1.2RC1 and 1.3.
With Zeos lib 6x, 7x
With SQL lite, MSSQL and Firebird
And in all cases I had the same problem with using wildcards, so I thought that problem must be somewhere in TDataSet component.
I published the problem on Lazasus forum but they anounced that this must be a problem with ZeosLib.
Regards,
Krzysztof
I noticed that using asterisk as filter works fine only when I use * at the end of fileterd string ie. 'Test*'
When I use asterisk at the beginning ie. '*test' or use two asteriscs in the filter reults are not intuitive.
I tested on firebird db and sqlite db. Lets create any db and a table TABLE with one column COLUMN and fill it with values (1,2,1150,4311). Lets connect to db using a query 'select COLUMN from TABLE'. I tested using Zeoslib 7.1.2 TZConnection and TZQuery. Let's put TDataSource and TDBGrid components on a form and fill the Filter property using: grid.DataSource.Dataset.Filter = '11*'. The result will be correct: 1150. But when you put two wildcards '*11*' or put wildcard on the beginning of the string the result will be wrong: (1,2,1150,1143) instead of (1150, 1143).
I worked with Lazarus 0.9.3, 1.0, 1.1.99-pre, 1.2RC1 and 1.3.
With Zeos lib 6x, 7x
With SQL lite, MSSQL and Firebird
And in all cases I had the same problem with using wildcards, so I thought that problem must be somewhere in TDataSet component.
I published the problem on Lazasus forum but they anounced that this must be a problem with ZeosLib.
Regards,
Krzysztof