Unverified 提交 ba15559f authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #1021 from katzyn/metadata

Update JdbcDatabaseMetaData to JDBC 4.1 (Java 7)
...@@ -49,6 +49,7 @@ public class TestMetaData extends TestBase { ...@@ -49,6 +49,7 @@ public class TestMetaData extends TestBase {
testColumnMetaData(); testColumnMetaData();
testColumnPrecision(); testColumnPrecision();
testColumnDefault(); testColumnDefault();
testColumnGenerated();
testCrossReferences(); testCrossReferences();
testProcedureColumns(); testProcedureColumns();
testUDTs(); testUDTs();
...@@ -234,6 +235,24 @@ public class TestMetaData extends TestBase { ...@@ -234,6 +235,24 @@ public class TestMetaData extends TestBase {
conn.close(); conn.close();
} }
private void testColumnGenerated() throws SQLException {
Connection conn = getConnection("metaData");
DatabaseMetaData meta = conn.getMetaData();
ResultSet rs;
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(A INT, B INT AS A + 1)");
rs = meta.getColumns(null, null, "TEST", null);
rs.next();
assertEquals("A", rs.getString("COLUMN_NAME"));
assertEquals("NO", rs.getString("IS_GENERATEDCOLUMN"));
rs.next();
assertEquals("B", rs.getString("COLUMN_NAME"));
assertEquals("YES", rs.getString("IS_GENERATEDCOLUMN"));
assertFalse(rs.next());
stat.execute("DROP TABLE TEST");
conn.close();
}
private void testProcedureColumns() throws SQLException { private void testProcedureColumns() throws SQLException {
Connection conn = getConnection("metaData"); Connection conn = getConnection("metaData");
DatabaseMetaData meta = conn.getMetaData(); DatabaseMetaData meta = conn.getMetaData();
...@@ -404,7 +423,7 @@ public class TestMetaData extends TestBase { ...@@ -404,7 +423,7 @@ public class TestMetaData extends TestBase {
meta.getDriverMinorVersion()); meta.getDriverMinorVersion());
int majorVersion = 4; int majorVersion = 4;
assertEquals(majorVersion, meta.getJDBCMajorVersion()); assertEquals(majorVersion, meta.getJDBCMajorVersion());
assertEquals(0, meta.getJDBCMinorVersion()); assertEquals(1, meta.getJDBCMinorVersion());
assertEquals("H2", meta.getDatabaseProductName()); assertEquals("H2", meta.getDatabaseProductName());
assertEquals(Connection.TRANSACTION_READ_COMMITTED, assertEquals(Connection.TRANSACTION_READ_COMMITTED,
meta.getDefaultTransactionIsolation()); meta.getDefaultTransactionIsolation());
...@@ -711,7 +730,7 @@ public class TestMetaData extends TestBase { ...@@ -711,7 +730,7 @@ public class TestMetaData extends TestBase {
"SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH",
"ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG",
"SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE",
"IS_AUTOINCREMENT", "SCOPE_CATLOG" }, new int[] { "IS_AUTOINCREMENT", "IS_GENERATEDCOLUMN" }, new int[] {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR,
......
...@@ -771,4 +771,4 @@ openoffice organize libre systemtables gmane sea borders announced millennium al ...@@ -771,4 +771,4 @@ openoffice organize libre systemtables gmane sea borders announced millennium al
opti excessively opti excessively
iterators tech enums incompatibilities loses reimplement readme reorganize milli subdirectory linkplain inspections iterators tech enums incompatibilities loses reimplement readme reorganize milli subdirectory linkplain inspections
geometries sourceschema destschema geometries sourceschema destschema generatedcolumn
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论