Subject Empty column names and ambiguous names for calc expressions
Author Dietrich Schulten
Hi,
this might be solved on engine level, so let me ask this here:

Interclient has a problem with getXXX(colname) under the following
circumstances.

First some background:
Interbase seems to return no column name for calculated columns or a
possibly ambiguous column name, depending what you are calculating.
Aggregate functions use the name of the function as column name (MAX),
calculations such as col1 * col2 return an empty column name.

The effect is, getXXX(colname) cannot find calculated columns because
resultset.findColumn(colname) fails. This is no surprise, considering the
column naming scheme for calculated columns.
However, using aliases doesn't help either. The only thing that helps are
ordinal numbers instead of column names: getXXX(int) works.

For a JDBC driver this is quite unfortunate, because you usually expect
to be able to use getXXX(colname) in applications, especially in
applications that rely heavily on metadata to allow user defined queries
etc.

I'm not sure what would be the best way, maybe it wouldn't be very
difficult to guarantee a meaningful column name on engine level. If not,
the driver would have to build an internal map, make up unique column
names for calculated columns and handle findColumn(String) based on this
map.
I tend to think that this should be done on engine or at least on driver
level. Otherwise we force applications to rely solely on ordinal numbers
and implement a name-alias-ordinal number map themselves.


Opinions?

Dietrich Schulten