Thread: ResultSetMetaData enhancements

ResultSetMetaData enhancements

From
Kris Jurka
Date:
This patch is the culmination of Jan-Andre's work on enhancing the
ResultSetMetaData methods with new information available in the V3
protocol.  He wandered off of the verge of completing it and I've just
done some minor reworking and editing.

This implements getSchemaName, getTableName, getColumnName,
getColumnLabel, and isNullable.

Kris Jurka

Attachment

Re: ResultSetMetaData enhancements

From
snpe
Date:
Hello,
  Is it in cvs (7.4, head ) ?

 happy new year

On Tuesday 30 December 2003 10:01 am, Kris Jurka wrote:
> This patch is the culmination of Jan-Andre's work on enhancing the
> ResultSetMetaData methods with new information available in the V3
> protocol.  He wandered off of the verge of completing it and I've just
> done some minor reworking and editing.
>
> This implements getSchemaName, getTableName, getColumnName,
> getColumnLabel, and isNullable.
>
> Kris Jurka

Re: ResultSetMetaData enhancements

From
Kris Jurka
Date:

On Wed, 31 Dec 2003, snpe wrote:

> Hello,
>   Is it in cvs (7.4, head ) ?

No.  I don't think it will go into 7.4 as it is a new feature and I don't
think anything will go into HEAD until the cvs repository is moved to
gborg.

Kris Jurka

>
> On Tuesday 30 December 2003 10:01 am, Kris Jurka wrote:
> > This patch is the culmination of Jan-Andre's work on enhancing the
> > ResultSetMetaData methods with new information available in the V3
> > protocol.  He wandered off of the verge of completing it and I've just
> > done some minor reworking and editing.
> >
> > This implements getSchemaName, getTableName, getColumnName,
> > getColumnLabel, and isNullable.
> >
> > Kris Jurka
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>


Re: ResultSetMetaData enhancements

From
ow
Date:
Is this going to be in 7.5? Thanks


> On Tuesday 30 December 2003 10:01 am, Kris Jurka wrote:
> > This patch is the culmination of Jan-Andre's work on enhancing the
> > ResultSetMetaData methods with new information available in the V3
> > protocol.  He wandered off of the verge of completing it and I've just
> > done some minor reworking and editing.
> >
> > This implements getSchemaName, getTableName, getColumnName,
> > getColumnLabel, and isNullable.
> >
> > Kris Jurka







__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

Re: ResultSetMetaData enhancements

From
Kris Jurka
Date:

On Mon, 12 Jul 2004, ow wrote:

> Is this going to be in 7.5? Thanks
>

Yes.  You can try it out now with the 7.5dev drivers available from
http://jdbc.postgresql.org/download.html.

Kris Jurka

Re: ResultSetMetaData enhancements

From
ow
Date:
Does the 7.5 driver require server upgrade to 7.5? Thanks

--- Kris Jurka <books@ejurka.com> wrote:
> Yes.  You can try it out now with the 7.5dev drivers available from
> http://jdbc.postgresql.org/download.html.
>
> Kris Jurka








__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

Re: ResultSetMetaData enhancements

From
Kris Jurka
Date:

On Mon, 12 Jul 2004, ow wrote:

> Does the 7.5 driver require server upgrade to 7.5? Thanks
>

No.  I've tested it for all versions going back to 7.2.  Although if you
want to use this feature you need at least a 7.4 server because it
requires using the new V3 protocol.

Kris Jurka

Re: ResultSetMetaData enhancements

From
ow
Date:
Hi,

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.

Am I wrong on that one? Thanks


--- Kris Jurka <books@ejurka.com> wrote:
> No.  I've tested it for all versions going back to 7.2.  Although if you
> want to use this feature you need at least a 7.4 server because it
> requires using the new V3 protocol.
>
> Kris Jurka










__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

Re: ResultSetMetaData enhancements

From
Kris Jurka
Date:

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