protected void initGetters()

in dekaf-jdbc/src/impl/JdbcRowFetchers.java [198:223]


    protected void initGetters(@NotNull final ResultSetMetaData md) {
      try {
        int n = components.length;
        Map<String, Integer> columnNames =
            new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
        for (int j = 1, cn = md.getColumnCount(); j <= cn; j++) {
          String columnName = JdbcUtil.getColumnName(md, j);
          columnNames.put(columnName, j);
        }

        for (int i = 0; i < n; i++) {
          String name = components[i].name;
          Integer columnIndex = columnNames.get(name);
          if (columnIndex == null) continue;
          int jdbcType = md.getColumnType(columnIndex);
          JdbcValueGetter valueGetter = JdbcValueGetters.of(jdbcType, components[i].clazz);
          columnIndices[i] = columnIndex;
          getters[i] = valueGetter;
        }
      }
      catch (SQLException sqle) {
        throw new UnexpectedDBException("Analysing metadata of the query result", sqle, null);
      }

      myRequiresInit = false;
    }