ml.
ml.

Reputation: 163

Query filter delphi firedac Firebird database

I´m migrating a database from SQLITE to Firebird, but now my query doesn't work.

What am I doing wrong? Is there a reason?

frmDados.Clientes.Close();   
frmDados.Clientes.SQL.Text := 
    'SELECT * FROM CLIENTES ' +
    'WHERE  (nomecliente like  :d1) '+
    'order by nomecliente asc';   
frmDados.Clientes.Params.ParamByName('d1').AsString := '%' + Edit1.text + '%';

frmDados.Clientes.OpenOrExecute();

Upvotes: 1

Views: 1469

Answers (1)

moskito-x
moskito-x

Reputation: 11958

Firebird dose not support case insensitive queries.

Query_Case_Insensitive.html

Consider these options

select * from "abc_table" where "Some_Field" = 'Abc'

select * from "abc_table" where "Some_Field" like 'Abc'

select * from "abc_table" where "Some_Field" containing 'Abc'

select * from "abc_table" where upper("Some_Field") = 'ABC'

Equals (=) and *like * both perform case sensitive matches
*containing * is case insensitive, but will also match 'abcd'
upper() works, but will not use an index and, therefore, will read every record in the table
Equals (=) is the fastest because it uses an index (if available)

Upvotes: 2

Related Questions