Skip to content

Commit

Permalink
[CONJ-1049] Metadata getTableTypes result was not ordered by TABLE_TYPE
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Dec 15, 2023
1 parent 0694cf2 commit f9018f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* CONJ-1137 ensuring never having NPE in OkPacket when setting auto commit
* CONJ-1138 Inconsistency in Behavior of PreparedStatement After closeOnCompletion() Between MariaDB and MySQL
Connectors
* CONJ-1049 Metadata getTableTypes result was not ordered by TABLE_TYPE

## [3.3.1](https://github.com/mariadb-corporation/mariadb-connector-j/tree/3.3.1) (Nov 2023)

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/mariadb/jdbc/DatabaseMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -2401,11 +2401,11 @@ public ResultSet getCatalogs() throws SQLException {

public ResultSet getTableTypes() throws SQLException {
return executeQuery(
"SELECT 'SYSTEM TABLE' TABLE_TYPE "
+ "UNION 'TABLE' TABLE_TYPE "
"SELECT 'LOCAL TEMPORARY' TABLE_TYPE "
+ "UNION SELECT 'SYSTEM TABLE' TABLE_TYPE "
+ "UNION SELECT 'SYSTEM VIEW' TABLE_TYPE "
+ "UNION SELECT 'VIEW' TABLE_TYPE "
+ "UNION SELECT 'LOCAL TEMPORARY' TABLE_TYPE");
+ "UNION SELECT 'TABLE' TABLE_TYPE "
+ "UNION SELECT 'VIEW' TABLE_TYPE");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,16 @@ public void databaseResultsetMeta() throws SQLException {
ResultSetMetaData rsMeta = rs.getMetaData();
assertEquals("TABLE_TYPE", rsMeta.getColumnName(1));
assertEquals("", rsMeta.getTableName(1));
assertEquals("TABLE", rs.getString(1));

assertEquals("LOCAL TEMPORARY", rs.getString(1));
assertTrue(rs.next());
assertEquals("SYSTEM TABLE", rs.getString(1));
assertTrue(rs.next());
assertEquals("SYSTEM VIEW", rs.getString(1));
assertTrue(rs.next());
assertEquals("VIEW", rs.getString(1));
assertEquals("TABLE", rs.getString(1));
assertTrue(rs.next());
assertEquals("LOCAL TEMPORARY", rs.getString(1));
assertEquals("VIEW", rs.getString(1));
assertFalse(rs.next());
}
}

0 comments on commit f9018f5

Please sign in to comment.