Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7d1b8c51
提交
7d1b8c51
authored
2月 08, 2013
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix issue #438 JdbcDatabaseMetaData#getSchemas() no longer supported as of 1.3.169
上级
4d176eaa
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
58 行增加
和
4 行删除
+58
-4
changelog.html
h2/src/docsrc/html/changelog.html
+1
-0
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+35
-3
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+22
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
7d1b8c51
...
...
@@ -62,6 +62,7 @@ Change Log
queries for in-memory databases using partial sort (by Sergi Vladykin).
</li><li>
Experimental off-heap memory storage engine "nioMemFS:" and "nioMemLZF:",
suggestion from Mark Addleman.
</li><li>
Fix issue #438:JdbcDatabaseMetaData#getSchemas() no longer supported as of 1.3.169
</li></ul>
<h2>
Version 1.3.170 (2012-11-30)
</h2>
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
7d1b8c51
...
...
@@ -2807,12 +2807,44 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
//*/
/**
* [Not supported] Gets the list of schemas.
* Gets the list of schemas in the database.
* The result set is sorted by TABLE_SCHEM.
*
* <ul>
* <li>1 TABLE_SCHEM (String) schema name
* </li><li>2 TABLE_CATALOG (String) catalog name
* </li><li>3 IS_DEFAULT (boolean) if this is the default schema
* </li></ul>
*
* @param catalogPattern null (to get all objects) or the catalog name
* @param schemaPattern null (to get all objects) or a schema name
* (uppercase for unquoted names)
* @return the schema list
* @throws SQLException if the connection is closed
*/
//## Java 1.6 ##
public
ResultSet
getSchemas
(
String
catalog
,
String
schemaPattern
)
public
ResultSet
getSchemas
(
String
catalog
Pattern
,
String
schemaPattern
)
throws
SQLException
{
throw
unsupported
(
"getSchemas(., .)"
);
try
{
debugCodeCall
(
"getSchemas(String,String)"
);
checkClosed
();
PreparedStatement
prep
=
conn
.
prepareAutoCloseStatement
(
"SELECT "
+
"SCHEMA_NAME TABLE_SCHEM, "
+
"CATALOG_NAME TABLE_CATALOG, "
+
" IS_DEFAULT "
+
"FROM INFORMATION_SCHEMA.SCHEMATA "
+
"WHERE CATALOG_NAME LIKE ? ESCAPE ? "
+
"AND SCHEMA_NAME LIKE ? ESCAPE ? "
+
"ORDER BY SCHEMA_NAME"
);
prep
.
setString
(
1
,
getCatalogPattern
(
catalogPattern
));
prep
.
setString
(
2
,
"\\"
);
prep
.
setString
(
3
,
getSchemaPattern
(
schemaPattern
));
prep
.
setString
(
4
,
"\\"
);
return
prep
.
executeQuery
();
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
//*/
...
...
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
7d1b8c51
...
...
@@ -75,6 +75,18 @@ public class TestMetaData extends TestBase {
assertEquals
(
"PUBLIC"
,
rs
.
getString
(
"TABLE_SCHEM"
));
assertFalse
(
rs
.
next
());
rs
=
meta
.
getSchemas
(
null
,
null
);
rs
.
next
();
assertEquals
(
"INFORMATION_SCHEMA"
,
rs
.
getString
(
"TABLE_SCHEM"
));
rs
.
next
();
assertEquals
(
"PUBLIC"
,
rs
.
getString
(
"TABLE_SCHEM"
));
assertFalse
(
rs
.
next
());
rs
=
meta
.
getSchemas
(
null
,
"PUBLIC"
);
rs
.
next
();
assertEquals
(
"PUBLIC"
,
rs
.
getString
(
"TABLE_SCHEM"
));
assertFalse
(
rs
.
next
());
rs
=
meta
.
getTableTypes
();
rs
.
next
();
assertEquals
(
"SYSTEM TABLE"
,
rs
.
getString
(
"TABLE_TYPE"
));
...
...
@@ -872,6 +884,15 @@ public class TestMetaData extends TestBase {
assertEquals
(
"PUBLIC"
,
rs
.
getString
(
1
));
assertFalse
(
rs
.
next
());
rs
=
meta
.
getSchemas
(
null
,
null
);
assertResultSetMeta
(
rs
,
3
,
new
String
[]
{
"TABLE_SCHEM"
,
"TABLE_CATALOG"
,
"IS_DEFAULT"
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
BOOLEAN
},
null
,
null
);
assertTrue
(
rs
.
next
());
assertEquals
(
"INFORMATION_SCHEMA"
,
rs
.
getString
(
1
));
assertTrue
(
rs
.
next
());
assertEquals
(
"PUBLIC"
,
rs
.
getString
(
1
));
assertFalse
(
rs
.
next
());
rs
=
meta
.
getCatalogs
();
assertResultSetMeta
(
rs
,
1
,
new
String
[]
{
"TABLE_CAT"
},
new
int
[]
{
Types
.
VARCHAR
},
null
,
null
);
assertResultSetOrdered
(
rs
,
new
String
[][]
{
{
CATALOG
}
});
...
...
@@ -926,7 +947,7 @@ public class TestMetaData extends TestBase {
meta
.
getProcedureColumns
(
null
,
null
,
null
,
null
);
meta
.
getProcedures
(
null
,
null
,
null
);
meta
.
getSchemas
();
//
meta.getSchemas(null, null);
meta
.
getSchemas
(
null
,
null
);
meta
.
getSuperTables
(
null
,
null
,
null
);
// meta.getSuperTypes(null, null, null);
meta
.
getTablePrivileges
(
null
,
null
,
null
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论