Colon inside quotes inside apostrophe in WHERE error

Colon inside quotes inside apostrophe in WHERE error

Postby 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
sotmihgeo
 
Posts: 2
Joined: Mon 21 Sep 2015 14:37

Re: Colon inside quotes inside apostrophe in WHERE error

Postby 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.
ViktorV
Devart Team
 
Posts: 1831
Joined: Wed 30 Jul 2014 07:16

Re: Colon inside quotes inside apostrophe in WHERE error

Postby 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.
sotmihgeo
 
Posts: 2
Joined: Mon 21 Sep 2015 14:37

Re: Colon inside quotes inside apostrophe in WHERE error

Postby 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"';
ViktorV
Devart Team
 
Posts: 1831
Joined: Wed 30 Jul 2014 07:16


Return to dbExpress driver for InterBase & Firebird