Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
3.1.3
-
None
-
MariaDB 10.11
Description
When I use DECIMAL(or FLOAT or DOUBLE) UNSIGNED to create a new table and ResultSetMetaData.getColumnTypeName() to get the column type name, I find that the result does not contain `UNSIGNED`.
For example, in the provided test case, MariaDB Connector J returns `DECIMAL` but Mysql Connector J returns `DECIMAL UNSIGNED`.
@Test
|
public void test() throws SQLException { |
String url = "jdbc:mariadb://localhost:3306?user=user&password=password"; |
Connection con = DriverManager.getConnection(url);
|
|
execute(con, "DROP DATABASE IF EXISTS test"); |
execute(con, "CREATE DATABASE test"); |
execute(con, "USE test"); |
execute(con, "CREATE TABLE IF NOT EXISTS t0(c0 DECIMAL UNSIGNED)"); |
execute(con, "INSERT INTO t0 VALUES(23987)"); |
|
Statement stmt = con.createStatement();
|
if (stmt.execute("SELECT * FROM t0")) { |
ResultSet rs = stmt.getResultSet();
|
ResultSetMetaData rsMetaData = rs.getMetaData();
|
int count = rsMetaData.getColumnCount(); |
StringBuffer sb = new StringBuffer(); |
|
for (int i = 1; i <= count; i++) { |
sb.append("* " + rsMetaData.getColumnTypeName(i) + " *"); |
}
|
System.out.println(sb);
|
}
|
}
|
|
public void execute(Connection con, String sql) { |
try { |
Statement statement = con.createStatement();
|
statement.execute(sql);
|
statement.close();
|
} catch (SQLException e) { |
e.printStackTrace();
|
}
|
}
|