Skip to content

Commit

Permalink
Added JSON metadata test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Divang Sharma committed Feb 12, 2025
1 parent a719e0a commit 9bac0eb
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,26 @@ public void shouldEscapeSchemaName() throws SQLException {
}
}

@Test
public void testJSONMetaData() throws SQLException {
String jsonTableName = RandomUtil.getIdentifier("try_SQLJSON_Table");

try (Statement stmt = connection.createStatement()) {
String sql = "create table " + AbstractSQLGenerator.escapeIdentifier(jsonTableName)
+ " (c1 JSON null);";
stmt.execute(sql);

String query = "SELECT * FROM " + AbstractSQLGenerator.escapeIdentifier(jsonTableName);
try (Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query)) {

ResultSetMetaData metaData = resultSet.getMetaData();
String columnType = metaData.getColumnTypeName(1);
assertTrue("JSON".equalsIgnoreCase(columnType));
}
}
}

@BeforeAll
public static void setupTable() throws Exception {
setConnection();
Expand Down

0 comments on commit 9bac0eb

Please sign in to comment.