protected static Row getMapForRow(ResultSet rs, boolean readStringsAsBytes) throws SQLException { ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); Row mapOfColValues = new Row(columnCount); for (int i = 1; i <= columnCount; i++) { String key = JdbcSqlTemplate.lookupColumnName(rsmd, i); Object obj = JdbcSqlTemplate.getResultSetValue(rs, i, readStringsAsBytes); mapOfColValues.put(key, obj); } return mapOfColValues; }
protected String buildSql(DmlType dmlType, String[] values, Column[] columns) { // TODO we should try to reuse statements // TODO support primary key updates DmlStatement statement = DmlStatementFactory.createDmlStatement(targetDatabaseName, dmlType, currentTable, useQuotedIdentifiers); Object[] objects = platform.getObjectValues(binaryEncoding, values, columns, false); Row row = new Row(columns.length); for (int i = 0; i < columns.length; i++) { row.put(columns[i].getName(), objects[i]); } return statement.buildDynamicSql(binaryEncoding, row, false, useJdbcTimestampFormat); }