Re: Missing fields in getColumns() result

From: Christian Schröder <cs(at)deriva(dot)de>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Missing fields in getColumns() result
Date: 2008-01-07 07:03:46
Message-ID: 4781CED2.2030305@deriva.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Kris Jurka wrote:
> I don't like splitting the code into columns + values and I don't like
> splitting the query into two parts as inconsistencies may occur in the
> face of concurrent updates. What about moving the existing
> implementation of getColumns to getColumns(int jdbcVersion), making it
> do different things based on the version provided and having
> getColumns() in Jdbc2/3 just provide the version to the new code.
The possible inconsistencies are indeed a problem!

I see three possible solutions:

1. Implement it as you suggested.
The only disadvantage of this approach is that the
AbstractJdbc2DatabaseMetaData would have to contain also the jdbc3
code. I personally would not expect to find the jdbc3
implementation in the jdbc2 class, but if that's ok to you I won't
complain about it.
2. Duplicate everything from the AbstractJdbc2DatabaseMetaData class
to AbstractJdbc3DatabaseMetaData and add the additional code here.
Doesn't seem an option to me. In my experience code duplication
should always be avoided.
3. Further split up the code (which you probably would like even less
*g*).
The database query could be constructed in one or more separate
functions which would be overridden in the
AbstractJdbc3DatabaseMetaData class. Sounds rather complicated,
but would keep the jdbc2 and jdbc3 implementations clearly separated.

It's up to you which approach you prefer. If you tell me which one you
want to have then I could implement it and send you a patch.

Regards,
Christian

--
Deriva GmbH Tel.: +49 551 489500-42
Financial IT and Consulting Fax: +49 551 489500-91
Hans-Böckler-Straße 2 http://www.deriva.de
D-37079 Göttingen

Deriva CA Certificate: http://www.deriva.de/deriva-ca.cer

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2008-01-07 07:15:54 Re: Missing fields in getColumns() result
Previous Message Kris Jurka 2008-01-07 06:24:23 Re: Patch for Statement.getGeneratedKeys()