Re: ResultSetMetaData enhancements

From: Kris Jurka <books(at)ejurka(dot)com>
To: ow <oneway_111(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSetMetaData enhancements
Date: 2004-07-13 04:30:55
Message-ID: Pine.BSO.4.56.0407122322440.17993@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message mjgacto 2004-07-13 07:37:19 Unsubcribe
Previous Message ow 2004-07-13 03:58:39 Re: ResultSetMetaData enhancements