Page 1 of 1

TMyQuery Addwhere with a LIMIT sentence

Posted: Fri 22 Sep 2006 08:38
by a.alekizoglou
Hi,

i am using MyDAC 3.55.0.26 with Delphi 7. I utilize TMyQuery's Addwhere procedure to support runtime queries. The proplem is that when i have a sentence like the above:

SELECT *
FROM conctact
WHERE (contact.bActive = TRUE)
LIMIT 1000

and add a new where clause with Addwhere like the one:

AddWhere('(strSurName = 'MATOWN')')

the SQL sentence goes like this

SELECT *
FROM conctact
WHERE ((contact.bActive = TRUE)
LIMIT 1000) AND (strSurName = 'MATOWN')

which of course is wrong.

Can anyone tell if the problem exists, and if so, is there any shortcut for this, or should we wait for a new release.

Regards,

Athanasios Alekizoglou

Posted: Fri 22 Sep 2006 09:01
by a.alekizoglou
OK,

it seems the problem is that i have a macro for adding the LIMIT xxx sentence where the macro is the entire sentence:

SELECT *
FROM conctact
WHERE (contact.bActive = TRUE)
&customlimit

So if i change this to

SELECT *
FROM conctact
WHERE (contact.bActive = TRUE)
LIMIT &customlimit

then the AddWhere works fine.

Posted: Fri 22 Sep 2006 13:34
by Antaeus
You have determined the reason of the problem correctly. This happens because AddWhere method does not analyze macros contents.