Re: ResultSetMetaData enhancements - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: ResultSetMetaData enhancements
Date
Msg-id Pine.BSO.4.56.0407122322440.17993@leary.csoft.net
Whole thread Raw
In response to Re: ResultSetMetaData enhancements  (ow <oneway_111@yahoo.com>)
List pgsql-jdbc

On Mon, 12 Jul 2004, ow wrote:

> Yes, rsmd.getTableName() appears to work. However, I was under
> impression that the folowing should also work (but it does not):
>
> someValue = rs.getXXX("table.column"); // instead of just rs.getXXX("column")
>
> This would be usefull if result set contained two columns from different
> tables with the same name.
>

It actually isn't rs.getXXX("column"), it's the alias given to a select
output.  Note that "SELECT a AS b FROM tab" will need to use
rs.getXXX("b"), not "a".  There are some rules for coming up with a
default alias which make the column name the alias for plain
columns without aliases.

Adding the tablename to the getXXX method doesn't seem any cleaner to me
than providing a select alias for the column and actually would have some
implementation issues.  Notably column names are allowed to have a . in
them, so how would you know when someone was providing a table name.

Kris Jurka

pgsql-jdbc by date:

Previous
From: ow
Date:
Subject: Re: ResultSetMetaData enhancements
Next
From: mjgacto@ugr.es
Date:
Subject: Unsubcribe