Re: FW: Question about the postgres resultset implementation

From: "Tornroth, Phill" <ptornroth(at)intellidot(dot)net>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: FW: Question about the postgres resultset implementation
Date: 2004-10-14 04:49:08
Message-ID: 967F41F63A2D10469114F0A19E56B17E0B0E99@SIRIUS.intellidot.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Wow, thanks! This will be very helpful to us. I can't believe the speed at which you've responded to this. I really appreciate it.

Are official releases of the JDBC driver tied to official releases of Postgres?

Phill

-----Original Message-----
From: Kris Jurka [mailto:books(at)ejurka(dot)com]
Sent: Wed 10/13/2004 2:03 PM
To: Tornroth, Phill
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] FW: Question about the postgres resultset implementation

On Wed, 13 Oct 2004, Kris Jurka wrote:

> I believe Peter's suggestion was to use a hashmap to cache the
> string->index mapping so that findColumn would only need to do the
> equalsIgnoreCase on the first call of that string, meaning once per column
> instead of for every call.
>

I've committed a fix to cvs following this suggestion. The new findColumn
method looks like this:

Kris Jurka

public int findColumn(String columnName) throws SQLException
{
Integer index = (Integer)columnNameIndexMap.get(columnName);
if (index != null) {
return index.intValue();
}

final int flen = fields.length;
for (int i = 0 ; i < flen; ++i) {
if (fields[i].getColumnLabel().equalsIgnoreCase(columnName)) {
index = new Integer(i+1);
columnNameIndexMap.put(columnName, index);
return index.intValue();
}
}

throw new PSQLException (GT.tr("The column name '{0}' was not found in this ResultSet.", columnName));
}

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Euler Taveira de Oliveira 2004-10-14 04:50:27 messages_*.class in CVS
Previous Message Euler Taveira de Oliveira 2004-10-14 04:36:30 Corrections and Translation update: pt_BR