return readIntoParams(tableOrViewName, qry);
}
private Map<String, DbParameterAccessor> readIntoParams(String objname,
String query) throws SQLException {
DbParameterAccessorsMapBuilder params = new DbParameterAccessorsMapBuilder();
if (objname.contains(".")) {
String[] schemaAndName = objname.split("[\\.]", 2);
objname = "[" + schemaAndName[0] + "].[" + schemaAndName[1] + "]";
} else {
objname = "[" + normaliseName(objname) + "]";
}
try (PreparedStatement dc = currentConnection.prepareStatement(query)) {
dc.setString(1, normaliseName(objname));
ResultSet rs = dc.executeQuery();
while (rs.next()) {
String paramName = defaultIfNull(rs.getString(1), "");
params.add(paramName,
getParameterDirection(rs.getInt(4), paramName),
getSqlType(rs.getString(2)),
getJavaClass(rs.getString(2)));
}
}
return params.toMap();
}