Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,26 @@ public List<JdbcFieldSchema> getJdbcColumnsInfo(String remoteDbName, String remo
int arrayDimensions = 0;
if (dataType == Types.ARRAY) {
String columnName = rs.getString("COLUMN_NAME");
try (PreparedStatement pstmt = conn.prepareStatement(
String.format("SELECT array_ndims(%s) FROM %s.%s LIMIT 1",
columnName, remoteDbName, remoteTableName))) {
try (ResultSet arrayRs = pstmt.executeQuery()) {
if (arrayRs.next()) {
arrayDimensions = arrayRs.getInt(1);
PreparedStatement pstmt = null;
ResultSet arrayRs = null;
try {
pstmt = conn.prepareStatement(
String.format("SELECT array_ndims(%s) FROM %s.%s LIMIT 1",
columnName, remoteDbName, remoteTableName));
arrayRs = pstmt.executeQuery();
if (arrayRs.next()) {
arrayDimensions = arrayRs.getInt(1);
}
} catch (SQLException ex) {
LOG.warn("Failed to get array dimensions for column {}: {}",
columnName, Util.getRootCauseMessage(ex));
} finally {
close(arrayRs, null);
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException ex) {
LOG.warn("Failed to close prepared statement: {}", Util.getRootCauseMessage(ex));
}
}
}
Expand Down