Skip to content

Commit

Permalink
Fix getFunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
rad-pat committed Jul 9, 2024
1 parent 7624185 commit a85c7dc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ public ResultSet getFunctions(String catalog, String schemaPattern, String funct
" name as FUNCTION_NAME, " +
" description as REMARKS, " +
" 1 as FUNCTION_TYPE, " +
" name as SPECIFIC_NAME" +
" name as SPECIFIC_NAME " +
"FROM system.functions");
List<String> filters = new ArrayList<>();
optionalStringLikeFilter(filters, "function_name", functionNamePattern);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,32 @@ public void testTableTypes() throws Exception {
}
}
}

@Test(groups = {"IT"})
public void testGetFunctions() throws Exception {
try (Connection connection = createConnection()) {
try (ResultSet rs = connection.getMetaData().getFunctions(null, null, "abs")) {
ResultSetMetaData metadata = rs.getMetaData();
assertEquals(metadata.getColumnCount(), 6);

assertEquals(metadata.getColumnLabel(1).toUpperCase(Locale.US), "FUNCTION_CAT");
assertEquals(metadata.getColumnType(1), Types.VARCHAR);

assertEquals(metadata.getColumnLabel(2).toUpperCase(Locale.US), "FUNCTION_SCHEMA");
assertEquals(metadata.getColumnType(2), Types.VARCHAR);

assertEquals(metadata.getColumnLabel(3).toUpperCase(Locale.US), "FUNCTION_NAME");
assertEquals(metadata.getColumnType(3), Types.VARCHAR);

assertEquals(metadata.getColumnLabel(4).toUpperCase(Locale.US), "REMARKS");
assertEquals(metadata.getColumnType(4), Types.VARCHAR);

assertEquals(metadata.getColumnLabel(5).toUpperCase(Locale.US), "FUNCTION_TYPE");
assertEquals(metadata.getColumnType(5), Types.INTEGER);

assertEquals(metadata.getColumnLabel(6).toUpperCase(Locale.US), "SPECIFIC_NAME");
assertEquals(metadata.getColumnType(6), Types.VARCHAR);
}
}
}
}

0 comments on commit a85c7dc

Please sign in to comment.