Re: FW: Question about the postgres resultset

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
Date: 2004-10-13 20:30:37
Message-ID: BD92DE7D.130A%ptornroth@intellidot.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Thanks for the speedy reply! I'm starting to believe that the best solution
is for the calling tool to simply remember the order of the parameters it
sent.

On 10/13/04 10:09 AM, "Kris Jurka" <books(at)ejurka(dot)com> 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.
>
That makes sense. I guess the fasted case scenario involves a call to
containsKey(Object) and then get(Object), unless you count on catching
exceptions once per column.

So something like this? :

if (myMap.containsKey(columnName)) {

return ((Integer)myMap.get(columnName).intValue());
}
else {

//...do the for loop with .equalsIgnoreCase() and
//put the entry in the map.
}

Phill

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-10-13 20:48:56 Re: odd insert problem, textarea \n replaced with <br> gives
Previous Message Dave Cramer 2004-10-13 20:22:53 Re: FW: Question about the postgres resultset implementation