Re: FW: Question about the postgres resultset
Re: FW: Question about the postgres resultset
От:
"Tornroth, Phill" <ptornroth@intellidot.net>
Дата:
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" 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