Colon inside quotes inside apostrophe in WHERE error

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
sotmihgeo
Posts: 2
Joined: Mon 21 Sep 2015 14:37

Colon inside quotes inside apostrophe in WHERE error

Post by sotmihgeo » Mon 21 Sep 2015 15:09

Hello, i have an unusual case that generates an error "no value for parameter...". The query is like:

Code: Select all

select * from table where field='"title:description"'
If i execute it in IBExpert it works just fine. If i drop the quotes it works (the colon inside apostrophes only). I use Delphi7 with dbexpida 4.4.6.0

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Colon inside quotes inside apostrophe in WHERE error

Post by ViktorV » Tue 22 Sep 2015 05:58

Unfortunately, we couldn't reproduce the problem. To investigate the problem, please compose a small sample reproducing the problem and send it to viktorv*devart*com, including scripts for creating database objects.

sotmihgeo
Posts: 2
Joined: Mon 21 Sep 2015 14:37

Re: Colon inside quotes inside apostrophe in WHERE error

Post by sotmihgeo » Tue 22 Sep 2015 07:20

Hello Viktor. Thanks for such a quick reply. Unfortunately (for me) the problem is caused by ParseSQL in DB.pas. The Literals array holds the delimiters for text values inside the sql command. The array contains both quotes and apostrophes as text values delimiters so instead of treating

Code: Select all

'"title:description"'
as a text it treats

Code: Select all

'"
as a text and

Code: Select all

title:description
as syntax.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Colon inside quotes inside apostrophe in WHERE error

Post by ViktorV » Tue 22 Sep 2015 08:31

To solve the problem, please try to use parameters instead of string constants. For example:

Code: Select all

  SQLQuery.SQL.Text := 'select * from table where field = :field';
  SQLQuery.ParamByName('field').asString := '"title:description"';

Post Reply