public static Map<String, Integer> createColumnNameIndexMap(Field[] fields, boolean isSanitiserDisabled) { Map<String, Integer> columnNameIndexMap = new HashMap<String, Integer>(fields.length * 2); // The JDBC spec says when you have duplicate columns names, // the first one should be returned. So load the map in // reverse order so the first ones will overwrite later ones. for (int i = fields.length - 1; i >= 0; i--) { String columnLabel = fields[i].getColumnLabel(); if (isSanitiserDisabled) { columnNameIndexMap.put(columnLabel, i + 1); } else { columnNameIndexMap.put(columnLabel.toLowerCase(Locale.US), i + 1); } } return columnNameIndexMap; }
public String getColumnLabel(int column) throws SQLException { Field field = getField(column); return field.getColumnLabel(); }
public String getColumnLabel(int column) throws SQLException { Field field = getField(column); return field.getColumnLabel(); }
private int findColumnIndex(String columnName) { if (columnNameIndexMap == null) { columnNameIndexMap = new HashMap(fields.length * 2); // The JDBC spec says when you have duplicate columns names, // the first one should be returned. So load the map in // reverse order so the first ones will overwrite later ones. for (int i = fields.length - 1; i >= 0; i--) { columnNameIndexMap.put(fields[i].getColumnLabel().toLowerCase(Locale.US), new Integer(i + 1)); } } Integer index = (Integer)columnNameIndexMap.get(columnName); if (index != null) { return index.intValue(); } index = (Integer)columnNameIndexMap.get(columnName.toLowerCase(Locale.US)); if (index != null) { columnNameIndexMap.put(columnName, index); return index.intValue(); } return 0; }
public String getColumnLabel(int column) throws SQLException { Field field = getField(column); return field.getColumnLabel(); }
public String getColumnLabel(int column) throws SQLException { Field field = getField(column); return field.getColumnLabel(); }
private int findColumnIndex(String columnName) { if (columnNameIndexMap == null) { columnNameIndexMap = new HashMap(fields.length * 2); // The JDBC spec says when you have duplicate columns names, // the first one should be returned. So load the map in // reverse order so the first ones will overwrite later ones. for (int i = fields.length - 1; i >= 0; i--) { columnNameIndexMap.put(fields[i].getColumnLabel().toLowerCase(Locale.US), new Integer(i + 1)); } } Integer index = (Integer)columnNameIndexMap.get(columnName); if (index != null) { return index.intValue(); } index = (Integer)columnNameIndexMap.get(columnName.toLowerCase(Locale.US)); if (index != null) { columnNameIndexMap.put(columnName, index); return index.intValue(); } return 0; }
private int findColumnIndex(String columnName) { if (columnNameIndexMap == null) { columnNameIndexMap = new HashMap(fields.length * 2); // The JDBC spec says when you have duplicate columns names, // the first one should be returned. So load the map in // reverse order so the first ones will overwrite later ones. for (int i = fields.length - 1; i >= 0; i--) { columnNameIndexMap.put(fields[i].getColumnLabel().toLowerCase(Locale.US), new Integer(i + 1)); } } Integer index = (Integer)columnNameIndexMap.get(columnName); if (index != null) { return index.intValue(); } index = (Integer)columnNameIndexMap.get(columnName.toLowerCase(Locale.US)); if (index != null) { columnNameIndexMap.put(columnName, index); return index.intValue(); } return 0; }