Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: IndexName causing error on query open



Permlink Replies: 1 - Last Post: Dec 2, 2016 1:48 AM Last Post By: Dmitry Arefiev
Eric Grajales

Posts: 9
Registered: 5/15/99
IndexName causing error on query open
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 1, 2016 2:05 PM
Hi,

I'm using XE8, FireDac, and connecting to FB 2.5 server.

I am trying to create a TFDQuery in code with indexes,
when I try to open the query, I get an error saying the
index name is not found. I've tried both index names, and both fail.
Debbuger says the indexes are there.

Here is the sample table I created:
CREATE TABLE "TEST"
(
"CUID" BIGINT NOT NULL,
"EUID" BIGINT NOT NULL,
"AUID" BIGINT NOT NULL,
"DESCRIPTION" VARCHAR(64) COLLATE UNICODE_CI,
CONSTRAINT "TEST_PRIMARY" PRIMARY KEY ("CUID", "EUID", "AUID")
);

Here is the Delphi code:
...
aqry := TFDQuery.Create(Application);
try
aqry.ConnectionName := 'TestConnection';
aqry.FetchOptions.AutoFetchAll := afAll;

aindx := aqry.Indexes.Add;
aindx.Name := 'Primary';
aindx.Fields := 'CUID';
aindx := aqry.Indexes.Add;
aindx.Name := 'DBOrder';
aindx.Fields := 'CUID;EUID;AUID';

aqry.Indexname := 'DBOrder';
aqry.IndexesActive := True;
aqry.SQL.Clear;
aqry.SQL.Add('select * from TEST ORDER BY CUID, EUID, AUID');
aqry.UpdateOptions.KeyFields := 'CUID;EUID;AUID';

aqry.Open(); // *** FAILS HERE

finally
;
end;

Thanks,
Eric

Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: IndexName causing error on query open
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 2, 2016 1:48 AM   in response to: Eric Grajales in response to: Eric Grajales
Set aindx.Active := True

--
With best regards,
Dmitry
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02