Subject Re: [firebird-support] Upgrade problem
Author Martijn Tonies
Hello,

> Since I upgraded one of my databases to Firebird 1.5 dialect 3, a curious
> incident occurred. Whenever my Delphi programs search with sql that
contains
> a ' as part of a string name, it ends the query. So, more than a year ago
a
> user entered the name
> VEHICULE DE L'AVANT BLIND
>
> In Firebird 1.2, he had no problem searching it. Now that I have upgraded,
> the system halts. I am not sure where to start. Help please.

Show us your code. It's not very good though ;-)

There are two ways to ignore those nasty quotes.

1) use the Delphi "QuotedString" function when concatenating a string
for SQL, eg:

Query.SQL.Add('select * from mytable where mysearch = ' +
QuotedString('VEHICULE DE L''AVANT BLIND'));

Which will double the single quote for you and surround it with quotes.

2) use parameters:

Query.SQL.Add('select * from mytable where mysearch = :myvalue');
Query.Prepare;
Query.ParamByName('myvalue').AsString := 'VEHICULE DE L''AVANT BLIND';
Query.Execute;

If there's somethign else you want, please explain it in more detail.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com