Re: ResultSetMetaData.getTableName() == null

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: ResultSetMetaData.getTableName() == null
Дата
Msg-id 45137742.9050600@opencloud.com
обсуждение исходный текст
Ответ на Re: ResultSetMetaData.getTableName() == null  (Philip Yarra <philip@utiba.com>)
Ответы Re: ResultSetMetaData.getTableName() == null
Список pgsql-jdbc
Philip Yarra wrote:

> so is there
> some reason why getTableName couldn't be re-written as:
>
> public String getTableName(int column) throws SQLException
> {
>     return getBaseTableName(column);
> }
>

We came to the conclusion in the original discussion that getTableName()
should return the aliased name of the table in the query, or the actual
table name if not aliased.

getBaseTableName() always returns the real underlying table name, even
if it was actually aliased to something else in the query. This reflects
the information that the server gives us (see the RowDescription message
in
http://www.postgresql.org/docs/8.1/static/protocol-message-formats.html
-- getBaseTableName() returns a name based on the table object ID in
that message)

So your suggested implementation would return incorrect information
whenever there were aliases involved.

We have no way of telling if aliasing has been done or not based on the
data returned by the server, so we can't even do it only when no aliases
are used.

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Philip Yarra
Дата:
Сообщение: Re: ResultSetMetaData.getTableName() == null
Следующее
От: Philip Yarra
Дата:
Сообщение: Re: ResultSetMetaData.getTableName() == null