Subject RE: [IBO] Search mode and table aliases
Author Aleš Kahánek
I have already traced and problem seems to be here, in the procedure
fld := '';
if ( SQLName <> '' ) then
if ( SQLType = SQL_VARYING ) or
( SQLType = SQL_VARYING_ ) or
( SQLType = SQL_TEXT ) or
( SQLType = SQL_TEXT_ ) then
fld := NoCaseFieldName;
if fld = '' then
fld := FullFieldName
SearchBuffer := AnsiUpperCase( SearchBuffer );
fld := BestFieldName
if fld = '' then
fld := GetCharValues( Statement.SysFieldNames[FieldNo] );

The procedures NoCaseFieldName, FullFieldName or BestFieldName do not know
nothing about the fact, than table is being used twice in the query with
different aliases and I guess, that IB API does not provide such type of
information. In the XSQLDA is defined variable char aliasname[32] and this
is the field alias, but I did not find anything about the table alias.

So I suppose that the following could help.
I am used to define in the TIB_Query.ColumnAttributes this entry (I use this
due to some specific processing, where I need to know the table alias):

We could somewhere check, if this alias is defined in the ColumnAttributes

if IsColAttributeSet[BestFieldName, 'ALIAS_TABLE'] then
fld := ColAttributeParams[BestFieldName, 'ALIAS_TABLE'] + '.' +

Or maybe introducing new property called RelAliasName could be a way.

This is only an idea, I would like to know your opinion and then if you
agree, I can do further changes and tests and send you the resulted code.


> -----Original Message-----
> From: Jason Wharton [mailto:jwharton@...]
> Sent: Thursday, April 10, 2003 12:41 AM
> To:
> Subject: Re: [IBO] Search mode and table aliases
> I wonder if you would not mind tracing into the code in
> IB_Parse.pas and see
> if you can suggest a fix for this.
> Thanks,
> Jason Wharton
> CPS - Computer Programming Solutions
> Mesa Arizona
> -- We may not have it all together --
> -- But together we have it all --