Index: src/com/mysql/jdbc/ResultSetImpl.java =================================================================== --- src/com/mysql/jdbc/ResultSetImpl.java (revision 6806) +++ src/com/mysql/jdbc/ResultSetImpl.java (working copy) @@ -235,6 +235,8 @@ protected Map columnNameToIndex = null; + protected Map columnToIndexCache = null; + protected boolean hasBuiltIndexMapping = false; /** @@ -718,6 +720,7 @@ this.fullColumnNameToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER); this.columnNameToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER); + this.columnToIndexCache = new HashMap(numFields); // We do this in reverse order, so that the 'first' column // with a given name ends up as the final mapping in the @@ -1093,6 +1096,12 @@ buildIndexMapping(); } + index = (Integer) this.columnToIndexCache.get(columnName); + + if (index != null) { + return index.intValue() + 1; + } + index = (Integer) this.columnLabelToIndex.get(columnName); if (index == null && this.useColumnNamesInFindColumn) { @@ -1104,6 +1113,7 @@ } if (index != null) { + this.columnToIndexCache.put(columnName, index); return index.intValue() + 1; }