Quotes

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Archer66
Posts: 17
Joined: Wed 11 Apr 2007 14:24

Quotes

Post by Archer66 » Mon 07 May 2007 16:01

Hi,

Quotes can't be used in SQL, for example

SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1''

works but

SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1""

does not.

Using quotes is required when creating SQL in code.

qryX.SQL.Add('SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1"" ');

Using Turbo Delphi, IBDAC 2.0.0.6

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 08 May 2007 06:05

This is not an IBDAC issue. InterBase interprets '' (two single quotes) as an empty value. When you use double quotes as quotation symbol, InterBase interprets it as an identifier name (e.g. table name, field name) in your case it tries to find an empty identifier.
As specified in Delphi/Pascal manual you should double single quotation symbol to include it in the string.
E.g.

Code: Select all

qryX.SQL.Add('SELECT FIELD1,FIELD2 FROM TABLE TABLE1 WHERE FIELD1'''' ');  //<< four ' symbols

Archer66
Posts: 17
Joined: Wed 11 Apr 2007 14:24

Post by Archer66 » Tue 08 May 2007 06:31

Thanks for the info.

Guess BDE translates "" to '''' bc I have used "" several years without a problem in old projects.

Post Reply