Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2a6869f9
Unverified
提交
2a6869f9
authored
3月 02, 2019
作者:
Noel Grandin
提交者:
GitHub
3月 02, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1784 from grandinj/improve_db_not_found_error
improve database not found error
上级
bada4125
1dc816b5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
18 行增加
和
8 行删除
+18
-8
ErrorCode.java
h2/src/main/org/h2/api/ErrorCode.java
+13
-5
Engine.java
h2/src/main/org/h2/engine/Engine.java
+1
-1
DbException.java
h2/src/main/org/h2/message/DbException.java
+1
-0
_messages_en.prop
h2/src/main/org/h2/res/_messages_en.prop
+1
-0
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+2
-2
没有找到文件。
h2/src/main/org/h2/api/ErrorCode.java
浏览文件 @
2a6869f9
...
...
@@ -611,13 +611,11 @@ public class ErrorCode {
public
static
final
int
PARAMETER_NOT_SET_1
=
90012
;
/**
* The error with code <code>90013</code> is thrown when trying to open a
* database that does not exist remotely without enabling remote database
* creation first, or using the flag IFEXISTS=TRUE, or when trying to access
* The error with code <code>90013</code> is thrown when when trying to access
* a database object with a catalog name that does not match the database
* name.
* <pre>
*
jdbc:h2:./database_that_does_not_exist
*
SELECT * FROM database_that_does_not_exist.table_name
* </pre>
*/
public
static
final
int
DATABASE_NOT_FOUND_1
=
90013
;
...
...
@@ -2052,7 +2050,17 @@ public class ErrorCode {
public
static
final
int
FOR_UPDATE_IS_NOT_ALLOWED_IN_DISTINCT_OR_GROUPED_SELECT
=
90145
;
// next is 90146
/**
* The error with code <code>90146</code> is thrown when trying to open a
* database that does not exist remotely without enabling remote database
* creation first, or using the flag IFEXISTS=TRUE
* <pre>
* jdbc:h2:./database_that_does_not_exist
* </pre>
*/
public
static
final
int
DATABASE_NOT_FOUND_2
=
90146
;
// next is 90147
private
ErrorCode
()
{
// utility class
...
...
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
2a6869f9
...
...
@@ -64,7 +64,7 @@ public class Engine implements SessionFactory {
}
if
(
database
==
null
)
{
if
(
ifExists
&&
!
Database
.
exists
(
name
))
{
throw
DbException
.
get
(
ErrorCode
.
DATABASE_NOT_FOUND_
1
,
name
);
throw
DbException
.
get
(
ErrorCode
.
DATABASE_NOT_FOUND_
2
,
name
);
}
database
=
new
Database
(
ci
,
cipher
);
opened
=
true
;
...
...
h2/src/main/org/h2/message/DbException.java
浏览文件 @
2a6869f9
...
...
@@ -587,6 +587,7 @@ public class DbException extends RuntimeException {
return
new
JdbcSQLDataException
(
message
,
sql
,
state
,
errorCode
,
cause
,
stackTrace
);
case
URL_RELATIVE_TO_CWD:
case
DATABASE_NOT_FOUND_1:
case
DATABASE_NOT_FOUND_2:
case
TRACE_CONNECTION_NOT_CLOSED:
case
DATABASE_ALREADY_OPEN_1:
case
FILE_CORRUPTED_1:
...
...
h2/src/main/org/h2/res/_messages_en.prop
浏览文件 @
2a6869f9
...
...
@@ -177,6 +177,7 @@
90143=Row {1} not found in primary index {0}
90144=Authenticator not enabled on database {0}
90145=FOR UPDATE is not allowed in DISTINCT or grouped select
90146=Database {0} not found, and IFEXISTS=true, so we can't auto-create it
HY000=General error: {0}
HY004=Unknown data type: {0}
HYC00=Feature not supported: {0}
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
2a6869f9
...
...
@@ -1125,12 +1125,12 @@ public class TestTools extends TestDb {
final
int
prt
=
tcpServerWithPassword
.
getPort
();
remainingServers
.
add
(
tcpServerWithPassword
);
// must not be able to create new db
new
AssertThrows
(
ErrorCode
.
DATABASE_NOT_FOUND_
1
)
{
new
AssertThrows
(
ErrorCode
.
DATABASE_NOT_FOUND_
2
)
{
@Override
public
void
test
()
throws
SQLException
{
getConnection
(
"jdbc:h2:tcp://localhost:"
+
prt
+
"/test2"
,
"sa"
,
""
);
}};
new
AssertThrows
(
ErrorCode
.
DATABASE_NOT_FOUND_
1
)
{
new
AssertThrows
(
ErrorCode
.
DATABASE_NOT_FOUND_
2
)
{
@Override
public
void
test
()
throws
SQLException
{
getConnection
(
"jdbc:h2:tcp://localhost:"
+
prt
+
"/test2;ifexists=false"
,
"sa"
,
""
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论