Subject RE: [IBO] Quoted fields seem to be broken in TIBODataset when they're involved in indexing
Author firebird@spence.users.panix.com
>
>-----Original Message-----
>From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On
Behalf Of Helen Borrie
>Sent: Monday, July 31, 2006 8:25 PM
>To: IBObjects@yahoogroups.com
>Subject: RE: [IBO] Quoted fields seem to be broken in TIBODataset when
they're involved in indexing
>
>
>At 06:13 AM 1/08/2006, you wrote:
>
>>
>>It knows what the KeyFields are, I've stepped through the code. It just
>>can't find them because it's comparing "Acc ID" to Acc ID (or more
>>precisely, ARINV."Acc ID" to Acc ID).
>
>Just *try* doing what I suggested, please. Turn off
>KeyLinksAutodefine and type in the quoted identifiers without the
>table qualifier, one beneath the other, as the KeyLinks.
>

Ok, I'll try again (this table's created at run time, so I have to do this
programatically):


tblInvoice.KeyLinksAutoDefine := false;
tblInvoice.KeyLinks.Add('Acc ID');
tblInvoice.KeyLinks.Add('Invoice #');
tblInvoice.KeyLinks.Add('DATE');

Doesn't work, when table is opened, I get "Invalid KeyLinks Entry: DATE".

Next, I'll try quoting all of the fields:

tblInvoice.KeyLinksAutoDefine := false;
tblInvoice.KeyLinks.Add('"Acc ID"');
tblInvoice.KeyLinks.Add('"Invoice #"');
tblInvoice.KeyLinks.Add('"DATE"');

Same error message when the table is opened.

Ok, I'll try not adding DATE at all, since it's clear that none of the index
stuff is happy with a field name that's a reserved word, even when I quote
it.

tblInvoice.KeyLinksAutoDefine := false;
tblInvoice.KeyLinks.Add('"Acc ID"');
tblInvoice.KeyLinks.Add('"Invoice #"');

Now, on the FindNearest, I get this: Cannot access index field ARINV."Acc
ID".

Ok, we'll turn that off.

>> > >None, because I'm using the primary key.
>> >
>> >Beg pardon, but what do you think that gets you?
>> >
>
>> It gets the primary key as the Order By fields , of course; try it and
>see what SQL you get if you're not using bizarre field names.
>
>Use IndexFieldNames, as a comma-separated string of the unqualified,
>quoted field names.
>


Now I'll try doing this right before the FindNearest:
tblInvoice.IndexFieldNames := '"Acc ID";"Invoice #";"DATE"';

That throws an EIBO_ISCError, which says Unknown Column: Date.

The SQL generated is this:
SELECT ALL ARINV.*
FROM ARINV
WHERE "Acc ID" = ? /* ID */
ORDER BY "Acc ID" ASC
, "Invoice #" ASC
, "DATE" ASC

Which looks like what I'd expect.

D'OH! This table (unlike some) actually has a leading cap Date, not all
caps DATE. I've gotten confused again!

Try again:
tblInvoice.IndexFieldNames := '"Acc ID";"Invoice #";"DATE"';

Better, we're back to this: Cannot access index field "Acc ID", which is
where this
all began.

Back to the KeyLinks, just in case:

tblInvoice.KeyLinksAutoDefine := false;
tblInvoice.KeyLinks.Add('"Acc ID"');
tblInvoice.KeyLinks.Add('"Invoice #"');
tblInvoice.KeyLinks.Add('"Date"');

Well, that's better too, in that it opens the table, but it just keeps
singing
that same old song : Cannot access index field ARINV."Acc ID" .




[Non-text portions of this message have been removed]