Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
be1fb4db
提交
be1fb4db
authored
8月 10, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
0b187779
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
35 个修改的文件
包含
258 行增加
和
119 行删除
+258
-119
AlterSequence.java
h2/src/main/org/h2/command/ddl/AlterSequence.java
+1
-1
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+1
-1
ErrorCode.java
h2/src/main/org/h2/constant/ErrorCode.java
+11
-11
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+2
-2
MetaRecord.java
h2/src/main/org/h2/engine/MetaRecord.java
+0
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+4
-4
LinkedIndex.java
h2/src/main/org/h2/index/LinkedIndex.java
+8
-4
Message.java
h2/src/main/org/h2/message/Message.java
+8
-4
TraceSystem.java
h2/src/main/org/h2/message/TraceSystem.java
+1
-1
_messages_en.properties
h2/src/main/org/h2/res/_messages_en.properties
+11
-11
TriggerObject.java
h2/src/main/org/h2/schema/TriggerObject.java
+2
-2
TcpServer.java
h2/src/main/org/h2/server/TcpServer.java
+7
-2
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+1
-1
FtpServer.java
h2/src/main/org/h2/server/ftp/FtpServer.java
+8
-2
PageParser.java
h2/src/main/org/h2/server/web/PageParser.java
+4
-3
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+2
-0
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+1
-1
RunScriptThread.java
h2/src/main/org/h2/tools/RunScriptThread.java
+0
-1
ByteUtils.java
h2/src/main/org/h2/util/ByteUtils.java
+2
-2
DateTimeUtils.java
h2/src/main/org/h2/util/DateTimeUtils.java
+1
-1
FileUtils.java
h2/src/main/org/h2/util/FileUtils.java
+3
-3
IntArray.java
h2/src/main/org/h2/util/IntArray.java
+1
-0
JdbcUtils.java
h2/src/main/org/h2/util/JdbcUtils.java
+23
-1
NetUtils.java
h2/src/main/org/h2/util/NetUtils.java
+1
-1
ObjectArray.java
h2/src/main/org/h2/util/ObjectArray.java
+3
-1
ValueDate.java
h2/src/main/org/h2/value/ValueDate.java
+1
-2
ValueDecimal.java
h2/src/main/org/h2/value/ValueDecimal.java
+1
-1
ValueString.java
h2/src/main/org/h2/value/ValueString.java
+2
-1
ValueStringFixed.java
h2/src/main/org/h2/value/ValueStringFixed.java
+2
-1
ValueTime.java
h2/src/main/org/h2/value/ValueTime.java
+1
-1
ValueTimestamp.java
h2/src/main/org/h2/value/ValueTimestamp.java
+1
-1
TestIntArray.java
h2/src/test/org/h2/test/unit/TestIntArray.java
+5
-2
PrepareTranslation.java
h2/src/tools/org/h2/tools/i18n/PrepareTranslation.java
+133
-47
PropertiesToUTF8.java
h2/src/tools/org/h2/tools/i18n/PropertiesToUTF8.java
+5
-1
没有找到文件。
h2/src/main/org/h2/command/ddl/AlterSequence.java
浏览文件 @
be1fb4db
...
@@ -36,7 +36,7 @@ public class AlterSequence extends DefineCommand {
...
@@ -36,7 +36,7 @@ public class AlterSequence extends DefineCommand {
public
void
setIncrement
(
long
increment
)
throws
SQLException
{
public
void
setIncrement
(
long
increment
)
throws
SQLException
{
newIncrement
=
true
;
newIncrement
=
true
;
if
(
increment
==
0
)
{
if
(
increment
==
0
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_VALUE_2
,
new
String
[]{
"0"
,
"INCREMENT"
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_VALUE_2
,
new
String
[]{
"0"
,
"INCREMENT"
});
}
}
this
.
increment
=
increment
;
this
.
increment
=
increment
;
}
}
...
...
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
be1fb4db
...
@@ -163,7 +163,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
...
@@ -163,7 +163,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
DbObject
child
=
(
DbObject
)
children
.
get
(
i
);
DbObject
child
=
(
DbObject
)
children
.
get
(
i
);
if
(
child
.
getType
()
==
DbObject
.
TABLE_OR_VIEW
)
{
if
(
child
.
getType
()
==
DbObject
.
TABLE_OR_VIEW
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
OPERATION_NOT_SUPPORTED_WITH_VIEWS_2
,
new
String
[]{
table
.
getName
(),
child
.
getName
()}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
OPERATION_NOT_SUPPORTED_WITH_VIEWS_2
,
new
String
[]{
table
.
getName
(),
child
.
getName
()});
}
}
}
}
}
}
...
...
h2/src/main/org/h2/constant/ErrorCode.java
浏览文件 @
be1fb4db
...
@@ -82,9 +82,9 @@ public class ErrorCode {
...
@@ -82,9 +82,9 @@ public class ErrorCode {
public
static
final
int
NULL_NOT_ALLOWED
=
90006
;
public
static
final
int
NULL_NOT_ALLOWED
=
90006
;
public
static
final
int
OBJECT_CLOSED
=
90007
;
public
static
final
int
OBJECT_CLOSED
=
90007
;
public
static
final
int
INVALID_VALUE_2
=
90008
;
public
static
final
int
INVALID_VALUE_2
=
90008
;
public
static
final
int
DATE_CONSTANT_
1
=
90009
;
public
static
final
int
DATE_CONSTANT_
2
=
90009
;
public
static
final
int
TIME_CONSTANT_
1
=
90010
;
public
static
final
int
TIME_CONSTANT_
2
=
90010
;
public
static
final
int
TIMESTAMP_CONSTANT_
1
=
90011
;
public
static
final
int
TIMESTAMP_CONSTANT_
2
=
90011
;
public
static
final
int
PARAMETER_NOT_SET_1
=
90012
;
public
static
final
int
PARAMETER_NOT_SET_1
=
90012
;
public
static
final
int
DATABASE_NOT_FOUND_1
=
90013
;
public
static
final
int
DATABASE_NOT_FOUND_1
=
90013
;
public
static
final
int
PARSE_ERROR_1
=
90014
;
public
static
final
int
PARSE_ERROR_1
=
90014
;
...
@@ -137,15 +137,15 @@ public class ErrorCode {
...
@@ -137,15 +137,15 @@ public class ErrorCode {
public
static
final
int
COLUMN_MUST_NOT_BE_NULLABLE_1
=
90023
;
public
static
final
int
COLUMN_MUST_NOT_BE_NULLABLE_1
=
90023
;
public
static
final
int
FILE_RENAME_FAILED_2
=
90024
;
public
static
final
int
FILE_RENAME_FAILED_2
=
90024
;
public
static
final
int
FILE_DELETE_FAILED_1
=
90025
;
public
static
final
int
FILE_DELETE_FAILED_1
=
90025
;
public
static
final
int
SERIALIZATION_FAILED
=
90026
;
public
static
final
int
SERIALIZATION_FAILED
_1
=
90026
;
public
static
final
int
DESERIALIZATION_FAILED
=
90027
;
public
static
final
int
DESERIALIZATION_FAILED
_1
=
90027
;
public
static
final
int
IO_EXCEPTION_1
=
90028
;
public
static
final
int
IO_EXCEPTION_1
=
90028
;
public
static
final
int
NOT_ON_UPDATABLE_ROW
=
90029
;
public
static
final
int
NOT_ON_UPDATABLE_ROW
=
90029
;
public
static
final
int
FILE_CORRUPTED_1
=
90030
;
public
static
final
int
FILE_CORRUPTED_1
=
90030
;
public
static
final
int
IO_EXCEPTION_2
=
90031
;
public
static
final
int
IO_EXCEPTION_2
=
90031
;
public
static
final
int
USER_NOT_FOUND_1
=
90032
;
public
static
final
int
USER_NOT_FOUND_1
=
90032
;
public
static
final
int
USER_ALREADY_EXISTS_1
=
90033
;
public
static
final
int
USER_ALREADY_EXISTS_1
=
90033
;
public
static
final
int
LOG_FILE_ERROR_
1
=
90034
;
public
static
final
int
LOG_FILE_ERROR_
2
=
90034
;
public
static
final
int
SEQUENCE_ALREADY_EXISTS_1
=
90035
;
public
static
final
int
SEQUENCE_ALREADY_EXISTS_1
=
90035
;
public
static
final
int
SEQUENCE_NOT_FOUND_1
=
90036
;
public
static
final
int
SEQUENCE_NOT_FOUND_1
=
90036
;
public
static
final
int
VIEW_NOT_FOUND_1
=
90037
;
public
static
final
int
VIEW_NOT_FOUND_1
=
90037
;
...
@@ -154,8 +154,8 @@ public class ErrorCode {
...
@@ -154,8 +154,8 @@ public class ErrorCode {
public
static
final
int
ADMIN_RIGHTS_REQUIRED
=
90040
;
public
static
final
int
ADMIN_RIGHTS_REQUIRED
=
90040
;
public
static
final
int
TRIGGER_ALREADY_EXISTS_1
=
90041
;
public
static
final
int
TRIGGER_ALREADY_EXISTS_1
=
90041
;
public
static
final
int
TRIGGER_NOT_FOUND_1
=
90042
;
public
static
final
int
TRIGGER_NOT_FOUND_1
=
90042
;
public
static
final
int
ERROR_CREATING_TRIGGER_OBJECT_
2
=
90043
;
public
static
final
int
ERROR_CREATING_TRIGGER_OBJECT_
3
=
90043
;
public
static
final
int
ERROR_EXECUTING_TRIGGER_
2
=
90044
;
public
static
final
int
ERROR_EXECUTING_TRIGGER_
3
=
90044
;
public
static
final
int
CONSTRAINT_ALREADY_EXISTS_1
=
90045
;
public
static
final
int
CONSTRAINT_ALREADY_EXISTS_1
=
90045
;
public
static
final
int
URL_FORMAT_ERROR_2
=
90046
;
public
static
final
int
URL_FORMAT_ERROR_2
=
90046
;
public
static
final
int
DRIVER_VERSION_ERROR_2
=
90047
;
public
static
final
int
DRIVER_VERSION_ERROR_2
=
90047
;
...
@@ -172,7 +172,7 @@ public class ErrorCode {
...
@@ -172,7 +172,7 @@ public class ErrorCode {
public
static
final
int
DUPLICATE_TABLE_ALIAS
=
90058
;
public
static
final
int
DUPLICATE_TABLE_ALIAS
=
90058
;
public
static
final
int
AMBIGUOUS_COLUMN_NAME_1
=
90059
;
public
static
final
int
AMBIGUOUS_COLUMN_NAME_1
=
90059
;
public
static
final
int
UNSUPPORTED_LOCK_METHOD_1
=
90060
;
public
static
final
int
UNSUPPORTED_LOCK_METHOD_1
=
90060
;
public
static
final
int
EXCEPTION_OPENING_PORT_
1
=
90061
;
public
static
final
int
EXCEPTION_OPENING_PORT_
2
=
90061
;
public
static
final
int
FILE_CREATION_FAILED_1
=
90062
;
public
static
final
int
FILE_CREATION_FAILED_1
=
90062
;
public
static
final
int
SAVEPOINT_IS_INVALID_1
=
90063
;
public
static
final
int
SAVEPOINT_IS_INVALID_1
=
90063
;
public
static
final
int
SAVEPOINT_IS_UNNAMED
=
90064
;
public
static
final
int
SAVEPOINT_IS_UNNAMED
=
90064
;
...
@@ -254,7 +254,7 @@ public class ErrorCode {
...
@@ -254,7 +254,7 @@ public class ErrorCode {
public
static
final
int
NOT_ENOUGH_RIGHTS_FOR_1
=
90096
;
public
static
final
int
NOT_ENOUGH_RIGHTS_FOR_1
=
90096
;
public
static
final
int
DATABASE_IS_READ_ONLY
=
90097
;
public
static
final
int
DATABASE_IS_READ_ONLY
=
90097
;
public
static
final
int
SIMULATED_POWER_OFF
=
90098
;
public
static
final
int
SIMULATED_POWER_OFF
=
90098
;
public
static
final
int
ERROR_SETTING_DATABASE_EVENT_LISTENER
=
90099
;
public
static
final
int
ERROR_SETTING_DATABASE_EVENT_LISTENER
_2
=
90099
;
public
static
final
int
NO_DISK_SPACE_AVAILABLE
=
90100
;
public
static
final
int
NO_DISK_SPACE_AVAILABLE
=
90100
;
public
static
final
int
WRONG_XID_FORMAT_1
=
90101
;
public
static
final
int
WRONG_XID_FORMAT_1
=
90101
;
public
static
final
int
UNSUPPORTED_COMPRESSION_OPTIONS_1
=
90102
;
public
static
final
int
UNSUPPORTED_COMPRESSION_OPTIONS_1
=
90102
;
...
@@ -266,7 +266,7 @@ public class ErrorCode {
...
@@ -266,7 +266,7 @@ public class ErrorCode {
public
static
final
int
STACK_OVERFLOW
=
90108
;
public
static
final
int
STACK_OVERFLOW
=
90108
;
public
static
final
int
VIEW_IS_INVALID_2
=
90109
;
public
static
final
int
VIEW_IS_INVALID_2
=
90109
;
public
static
final
int
OVERFLOW_FOR_TYPE_1
=
90110
;
public
static
final
int
OVERFLOW_FOR_TYPE_1
=
90110
;
public
static
final
int
ERROR_ACCESSING_LINKED_TABLE_
1
=
90111
;
public
static
final
int
ERROR_ACCESSING_LINKED_TABLE_
2
=
90111
;
/**
/**
* When locking was disabled, a row was deleted twice.
* When locking was disabled, a row was deleted twice.
...
...
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
be1fb4db
...
@@ -327,7 +327,7 @@ public class ConnectionInfo {
...
@@ -327,7 +327,7 @@ public class ConnectionInfo {
public
SQLException
getFormatException
()
{
public
SQLException
getFormatException
()
{
String
format
=
Constants
.
URL_FORMAT
;
String
format
=
Constants
.
URL_FORMAT
;
return
Message
.
getSQLException
(
ErrorCode
.
URL_FORMAT_ERROR_2
,
new
String
[]{
format
,
url
}
,
null
);
return
Message
.
getSQLException
(
ErrorCode
.
URL_FORMAT_ERROR_2
,
new
String
[]{
format
,
url
});
}
}
}
}
h2/src/main/org/h2/engine/Database.java
浏览文件 @
be1fb4db
...
@@ -1140,7 +1140,7 @@ public class Database implements DataHandler {
...
@@ -1140,7 +1140,7 @@ public class Database implements DataHandler {
String
invalid
=
getFirstInvalidTable
();
String
invalid
=
getFirstInvalidTable
();
if
(
invalid
!=
null
)
{
if
(
invalid
!=
null
)
{
obj
.
getSchema
().
add
(
obj
);
obj
.
getSchema
().
add
(
obj
);
throw
Message
.
getSQLException
(
ErrorCode
.
CANNOT_DROP_2
,
new
String
[]{
obj
.
getSQL
(),
invalid
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
CANNOT_DROP_2
,
new
String
[]{
obj
.
getSQL
(),
invalid
});
}
}
int
id
=
obj
.
getId
();
int
id
=
obj
.
getId
();
obj
.
removeChildrenAndResources
(
session
);
obj
.
removeChildrenAndResources
(
session
);
...
@@ -1246,7 +1246,7 @@ public class Database implements DataHandler {
...
@@ -1246,7 +1246,7 @@ public class Database implements DataHandler {
eventListener
=
(
DatabaseEventListener
)
loadClass
(
className
).
newInstance
();
eventListener
=
(
DatabaseEventListener
)
loadClass
(
className
).
newInstance
();
eventListener
.
init
(
databaseURL
);
eventListener
.
init
(
databaseURL
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_SETTING_DATABASE_EVENT_LISTENER
,
new
String
[]{
className
},
e
);
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_SETTING_DATABASE_EVENT_LISTENER
_2
,
new
String
[]{
className
,
e
.
toString
()
},
e
);
}
}
}
}
}
}
...
...
h2/src/main/org/h2/engine/MetaRecord.java
浏览文件 @
be1fb4db
...
@@ -9,7 +9,6 @@ import java.util.Comparator;
...
@@ -9,7 +9,6 @@ import java.util.Comparator;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.command.Prepared
;
import
org.h2.command.Prepared
;
import
org.h2.constant.ErrorCode
;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.message.Trace
;
import
org.h2.message.Trace
;
import
org.h2.result.SearchRow
;
import
org.h2.result.SearchRow
;
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
be1fb4db
...
@@ -341,7 +341,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -341,7 +341,7 @@ public class Function extends Expression implements FunctionCall {
varArgs
.
add
(
param
);
varArgs
.
add
(
param
);
}
else
{
}
else
{
if
(
index
>=
args
.
length
)
{
if
(
index
>=
args
.
length
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_PARAMETER_COUNT_2
,
new
String
[]
{
info
.
name
,
""
+
args
.
length
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_PARAMETER_COUNT_2
,
new
String
[]
{
info
.
name
,
""
+
args
.
length
});
}
}
args
[
index
]
=
param
;
args
[
index
]
=
param
;
}
}
...
@@ -957,7 +957,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -957,7 +957,7 @@ public class Function extends Expression implements FunctionCall {
private
static
int
getDatePart
(
String
part
)
throws
SQLException
{
private
static
int
getDatePart
(
String
part
)
throws
SQLException
{
Integer
p
=
(
Integer
)
datePart
.
get
(
StringUtils
.
toUpperEnglish
(
part
));
Integer
p
=
(
Integer
)
datePart
.
get
(
StringUtils
.
toUpperEnglish
(
part
));
if
(
p
==
null
)
{
if
(
p
==
null
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_VALUE_2
,
new
String
[]
{
"date part"
,
part
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_VALUE_2
,
new
String
[]
{
"date part"
,
part
});
}
}
return
p
.
intValue
();
return
p
.
intValue
();
}
}
...
@@ -1300,7 +1300,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1300,7 +1300,7 @@ public class Function extends Expression implements FunctionCall {
}
}
boolean
ok
=
(
len
>=
min
)
&&
(
len
<=
max
);
boolean
ok
=
(
len
>=
min
)
&&
(
len
<=
max
);
if
(!
ok
)
{
if
(!
ok
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_PARAMETER_COUNT_2
,
new
String
[]{
info
.
name
,
min
+
".."
+
max
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_PARAMETER_COUNT_2
,
new
String
[]{
info
.
name
,
min
+
".."
+
max
});
}
}
args
=
new
Expression
[
len
];
args
=
new
Expression
[
len
];
varArgs
.
toArray
(
args
);
varArgs
.
toArray
(
args
);
...
@@ -1308,7 +1308,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1308,7 +1308,7 @@ public class Function extends Expression implements FunctionCall {
}
else
{
}
else
{
int
len
=
args
.
length
;
int
len
=
args
.
length
;
if
(
len
>
0
&&
args
[
len
-
1
]
==
null
)
{
if
(
len
>
0
&&
args
[
len
-
1
]
==
null
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_PARAMETER_COUNT_2
,
new
String
[]{
info
.
name
,
""
+
len
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
INVALID_PARAMETER_COUNT_2
,
new
String
[]{
info
.
name
,
""
+
len
});
}
}
}
}
}
}
...
...
h2/src/main/org/h2/index/LinkedIndex.java
浏览文件 @
be1fb4db
...
@@ -75,7 +75,7 @@ public class LinkedIndex extends Index {
...
@@ -75,7 +75,7 @@ public class LinkedIndex extends Index {
prep
.
executeUpdate
();
prep
.
executeUpdate
();
rowCount
++;
rowCount
++;
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_ACCESSING_LINKED_TABLE_1
,
new
String
[]{
sql
}
,
e
);
throw
wrapException
(
sql
,
e
);
}
}
}
}
...
@@ -126,7 +126,7 @@ public class LinkedIndex extends Index {
...
@@ -126,7 +126,7 @@ public class LinkedIndex extends Index {
ResultSet
rs
=
prep
.
executeQuery
();
ResultSet
rs
=
prep
.
executeQuery
();
return
new
LinkedCursor
(
table
,
rs
,
session
);
return
new
LinkedCursor
(
table
,
rs
,
session
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_ACCESSING_LINKED_TABLE_1
,
new
String
[]{
sql
}
,
e
);
throw
wrapException
(
sql
,
e
);
}
}
}
}
...
@@ -195,7 +195,7 @@ public class LinkedIndex extends Index {
...
@@ -195,7 +195,7 @@ public class LinkedIndex extends Index {
int
count
=
prep
.
executeUpdate
();
int
count
=
prep
.
executeUpdate
();
rowCount
-=
count
;
rowCount
-=
count
;
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_ACCESSING_LINKED_TABLE_1
,
new
String
[]{
sql
}
,
e
);
throw
wrapException
(
sql
,
e
);
}
}
}
}
...
@@ -238,8 +238,12 @@ public class LinkedIndex extends Index {
...
@@ -238,8 +238,12 @@ public class LinkedIndex extends Index {
}
}
prep
.
executeUpdate
();
prep
.
executeUpdate
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_ACCESSING_LINKED_TABLE_1
,
new
String
[]{
sql
}
,
e
);
throw
wrapException
(
sql
,
e
);
}
}
}
}
private
SQLException
wrapException
(
String
sql
,
SQLException
e
)
{
return
Message
.
getSQLException
(
ErrorCode
.
ERROR_ACCESSING_LINKED_TABLE_2
,
new
String
[]{
sql
,
e
.
toString
()},
e
);
}
}
}
h2/src/main/org/h2/message/Message.java
浏览文件 @
be1fb4db
...
@@ -63,7 +63,7 @@ public class Message {
...
@@ -63,7 +63,7 @@ public class Message {
* @return the SQLException object
* @return the SQLException object
*/
*/
public
static
JdbcSQLException
getSQLException
(
int
sqlState
,
String
p1
)
{
public
static
JdbcSQLException
getSQLException
(
int
sqlState
,
String
p1
)
{
return
getSQLException
(
sqlState
,
new
String
[]
{
p1
}
,
null
);
return
getSQLException
(
sqlState
,
new
String
[]
{
p1
});
}
}
public
static
String
translate
(
String
key
,
String
[]
param
)
{
public
static
String
translate
(
String
key
,
String
[]
param
)
{
...
@@ -84,6 +84,10 @@ public class Message {
...
@@ -84,6 +84,10 @@ public class Message {
return
new
JdbcSQLException
(
message
,
null
,
sqlstate
,
errorCode
,
cause
,
null
);
return
new
JdbcSQLException
(
message
,
null
,
sqlstate
,
errorCode
,
cause
,
null
);
}
}
public
static
JdbcSQLException
getSQLException
(
int
errorCode
,
String
[]
param
)
{
return
getSQLException
(
errorCode
,
param
);
}
public
static
SQLException
getSyntaxError
(
String
sql
,
int
index
)
{
public
static
SQLException
getSyntaxError
(
String
sql
,
int
index
)
{
sql
=
StringUtils
.
addAsterisk
(
sql
,
index
);
sql
=
StringUtils
.
addAsterisk
(
sql
,
index
);
return
getSQLException
(
ErrorCode
.
SYNTAX_ERROR_1
,
sql
);
return
getSQLException
(
ErrorCode
.
SYNTAX_ERROR_1
,
sql
);
...
@@ -91,7 +95,7 @@ public class Message {
...
@@ -91,7 +95,7 @@ public class Message {
public
static
SQLException
getSyntaxError
(
String
sql
,
int
index
,
String
expected
)
{
public
static
SQLException
getSyntaxError
(
String
sql
,
int
index
,
String
expected
)
{
sql
=
StringUtils
.
addAsterisk
(
sql
,
index
);
sql
=
StringUtils
.
addAsterisk
(
sql
,
index
);
return
getSQLException
(
ErrorCode
.
SYNTAX_ERROR_2
,
new
String
[]{
sql
,
expected
}
,
null
);
return
getSQLException
(
ErrorCode
.
SYNTAX_ERROR_2
,
new
String
[]{
sql
,
expected
});
}
}
/**
/**
...
@@ -102,7 +106,7 @@ public class Message {
...
@@ -102,7 +106,7 @@ public class Message {
* @return the SQLException object
* @return the SQLException object
*/
*/
public
static
JdbcSQLException
getSQLException
(
int
sqlstate
)
{
public
static
JdbcSQLException
getSQLException
(
int
sqlstate
)
{
return
getSQLException
(
sqlstate
,
null
);
return
getSQLException
(
sqlstate
,
(
String
)
null
);
}
}
public
static
JdbcSQLException
getUnsupportedException
()
{
public
static
JdbcSQLException
getUnsupportedException
()
{
...
@@ -110,7 +114,7 @@ public class Message {
...
@@ -110,7 +114,7 @@ public class Message {
}
}
public
static
JdbcSQLException
getInvalidValueException
(
String
value
,
String
param
)
{
public
static
JdbcSQLException
getInvalidValueException
(
String
value
,
String
param
)
{
return
getSQLException
(
ErrorCode
.
INVALID_VALUE_2
,
new
String
[]{
value
,
param
}
,
null
);
return
getSQLException
(
ErrorCode
.
INVALID_VALUE_2
,
new
String
[]{
value
,
param
});
}
}
public
static
Error
getInternalError
(
String
s
)
{
public
static
Error
getInternalError
(
String
s
)
{
...
...
h2/src/main/org/h2/message/TraceSystem.java
浏览文件 @
be1fb4db
...
@@ -193,7 +193,7 @@ public class TraceSystem {
...
@@ -193,7 +193,7 @@ public class TraceSystem {
}
}
writingErrorLogged
=
true
;
writingErrorLogged
=
true
;
// TODO translate trace messages
// TODO translate trace messages
SQLException
se
=
Message
.
getSQLException
(
ErrorCode
.
LOG_FILE_ERROR_
1
,
new
String
[]
{
fileName
},
e
);
SQLException
se
=
Message
.
getSQLException
(
ErrorCode
.
LOG_FILE_ERROR_
2
,
new
String
[]
{
fileName
,
e
.
toString
()
},
e
);
// print this error only once
// print this error only once
fileName
=
null
;
fileName
=
null
;
System
.
out
.
println
(
se
);
System
.
out
.
println
(
se
);
...
...
h2/src/main/org/h2/res/_messages_en.properties
浏览文件 @
be1fb4db
...
@@ -29,9 +29,9 @@
...
@@ -29,9 +29,9 @@
90006
=
NULL not allowed for column {0}
90006
=
NULL not allowed for column {0}
90007
=
The object is already closed
90007
=
The object is already closed
90008
=
Invalid value {0} for parameter {1}
90008
=
Invalid value {0} for parameter {1}
90009
=
Cannot parse date constant {0}
90009
=
Cannot parse date constant {0}
, cause
\:
{1}
90010
=
Cannot parse time constant {0}
90010
=
Cannot parse time constant {0}
, cause
\:
{1}
90011
=
Cannot parse timestamp constant {0}
90011
=
Cannot parse timestamp constant {0}
, cause
\:
{1}
90012
=
Parameter {0} is not set
90012
=
Parameter {0} is not set
90013
=
Database {0} not found
90013
=
Database {0} not found
90014
=
Error parsing {0}
90014
=
Error parsing {0}
...
@@ -46,15 +46,15 @@
...
@@ -46,15 +46,15 @@
90023
=
Column {0} must not be nullable
90023
=
Column {0} must not be nullable
90024
=
Error while renaming file {0} to {1}
90024
=
Error while renaming file {0} to {1}
90025
=
Cannot delete file {0}
90025
=
Cannot delete file {0}
90026
=
Serialization failed
90026
=
Serialization failed
, cause
\:
{0}
90027
=
Deserialization failed
90027
=
Deserialization failed
, cause
\:
{0}
90028
=
IO Exception
\:
{0}
90028
=
IO Exception
\:
{0}
90029
=
Currently not on an updatable row
90029
=
Currently not on an updatable row
90030
=
File corrupted while reading record
\:
{0}. Possible solution
\:
use the recovery tool
90030
=
File corrupted while reading record
\:
{0}. Possible solution
\:
use the recovery tool
90031
=
IO Exception
\:
{0}; {1}
90031
=
IO Exception
\:
{0}; {1}
90032
=
User {0} not found
90032
=
User {0} not found
90033
=
User {0} already exists
90033
=
User {0} already exists
90034
=
Log file error
\:
{0}
90034
=
Log file error
\:
{0}
, cause
\:
{1}
90035
=
Sequence {0} already exists
90035
=
Sequence {0} already exists
90036
=
Sequence {0} not found
90036
=
Sequence {0} not found
90037
=
View {0} not found
90037
=
View {0} not found
...
@@ -63,8 +63,8 @@
...
@@ -63,8 +63,8 @@
90040
=
Admin rights are required for this operation
90040
=
Admin rights are required for this operation
90041
=
Trigger {0} already exists
90041
=
Trigger {0} already exists
90042
=
Trigger {0} not found
90042
=
Trigger {0} not found
90043
=
Error creating or initializing trigger {0} object, class {1}; see root cause for details
90043
=
Error creating or initializing trigger {0} object, class {1}
, cause
\:
{2}
; see root cause for details
90044
=
Error executing trigger {0}, class {1}; see root cause for details
90044
=
Error executing trigger {0}, class {1}
, cause
\:
{2}
; see root cause for details
90045
=
Constraint {0} already exists
90045
=
Constraint {0} already exists
90046
=
URL format error; must be {0} but is {1}
90046
=
URL format error; must be {0} but is {1}
90047
=
Version mismatch, driver version is {0} but server version is {1}
90047
=
Version mismatch, driver version is {0} but server version is {1}
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
90058
=
Duplicate table or table alias {0}
90058
=
Duplicate table or table alias {0}
90059
=
Ambiguous column name {0}
90059
=
Ambiguous column name {0}
90060
=
Unsupported file lock method {0}
90060
=
Unsupported file lock method {0}
90061
=
Exception opening port {0} (port may be in use)
90061
=
Exception opening port {0} (port may be in use)
, cause
\:
{1}
90062
=
Error while creating file {0}
90062
=
Error while creating file {0}
90063
=
Savepoint is invalid
\:
{0}
90063
=
Savepoint is invalid
\:
{0}
90064
=
Savepoint is unnamed
90064
=
Savepoint is unnamed
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
90096
=
Not enough rights for object {0}
90096
=
Not enough rights for object {0}
90097
=
The database is read only
90097
=
The database is read only
90098
=
The database has been closed
90098
=
The database has been closed
90099
=
Error setting database event listener {0}
90099
=
Error setting database event listener {0}
, cause
\:
{1}
90100
=
No disk space available
90100
=
No disk space available
90101
=
Wrong XID format
\:
{0}
90101
=
Wrong XID format
\:
{0}
90102
=
Unsupported compression options
\:
{0}
90102
=
Unsupported compression options
\:
{0}
...
@@ -131,7 +131,7 @@
...
@@ -131,7 +131,7 @@
90108
=
Stack overflow (recursive query or function?)
90108
=
Stack overflow (recursive query or function?)
90109
=
View {0} is invalid
\:
{1}
90109
=
View {0} is invalid
\:
{1}
90110
=
{0} out of range
90110
=
{0} out of range
90111
=
Error accessing linked table with SQL statement {0}
90111
=
Error accessing linked table with SQL statement {0}
, cause
\:
{1}
90112
=
Row not found when trying to delete from index {0}
90112
=
Row not found when trying to delete from index {0}
90113
=
Unsupported connection setting {0}
90113
=
Unsupported connection setting {0}
90114
=
Constant {0} already exists
90114
=
Constant {0} already exists
...
...
h2/src/main/org/h2/schema/TriggerObject.java
浏览文件 @
be1fb4db
...
@@ -56,7 +56,7 @@ public class TriggerObject extends SchemaObject {
...
@@ -56,7 +56,7 @@ public class TriggerObject extends SchemaObject {
triggerCallback
=
(
Trigger
)
obj
;
triggerCallback
=
(
Trigger
)
obj
;
triggerCallback
.
init
(
c2
,
getSchema
().
getName
(),
getName
(),
table
.
getName
());
triggerCallback
.
init
(
c2
,
getSchema
().
getName
(),
getName
(),
table
.
getName
());
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_CREATING_TRIGGER_OBJECT_
2
,
new
String
[]{
getName
(),
triggerClassName
},
e
);
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_CREATING_TRIGGER_OBJECT_
3
,
new
String
[]{
getName
(),
triggerClassName
,
e
.
toString
()
},
e
);
}
}
}
}
...
@@ -68,7 +68,7 @@ public class TriggerObject extends SchemaObject {
...
@@ -68,7 +68,7 @@ public class TriggerObject extends SchemaObject {
try
{
try
{
triggerCallback
.
fire
(
c2
,
null
,
null
);
triggerCallback
.
fire
(
c2
,
null
,
null
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_EXECUTING_TRIGGER_
2
,
new
String
[]{
getName
(),
triggerClassName
},
e
);
throw
Message
.
getSQLException
(
ErrorCode
.
ERROR_EXECUTING_TRIGGER_
3
,
new
String
[]{
getName
(),
triggerClassName
,
e
.
toString
()
},
e
);
}
}
}
}
...
...
h2/src/main/org/h2/server/TcpServer.java
浏览文件 @
be1fb4db
...
@@ -8,13 +8,14 @@ import java.io.IOException;
...
@@ -8,13 +8,14 @@ import java.io.IOException;
import
java.net.ServerSocket
;
import
java.net.ServerSocket
;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Properties
;
import
org.h2.Driver
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.message.TraceSystem
;
import
org.h2.message.TraceSystem
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
...
@@ -51,7 +52,11 @@ public class TcpServer implements Service {
...
@@ -51,7 +52,11 @@ public class TcpServer implements Service {
}
}
private
void
initManagementDb
()
throws
SQLException
{
private
void
initManagementDb
()
throws
SQLException
{
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:"
+
getManagementDbName
(
port
),
"sa"
,
managementPassword
);
Properties
prop
=
new
Properties
();
prop
.
setProperty
(
"user"
,
"sa"
);
prop
.
setProperty
(
"password"
,
managementPassword
);
// avoid using the driver manager
Connection
conn
=
Driver
.
load
().
connect
(
"jdbc:h2:"
+
getManagementDbName
(
port
),
prop
);
managementDb
=
conn
;
managementDb
=
conn
;
Statement
stat
=
null
;
Statement
stat
=
null
;
try
{
try
{
...
...
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
be1fb4db
...
@@ -55,7 +55,7 @@ public class TcpServerThread implements Runnable {
...
@@ -55,7 +55,7 @@ public class TcpServerThread implements Runnable {
}
}
if
(
version
!=
Constants
.
TCP_DRIVER_VERSION
)
{
if
(
version
!=
Constants
.
TCP_DRIVER_VERSION
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
DRIVER_VERSION_ERROR_2
,
throw
Message
.
getSQLException
(
ErrorCode
.
DRIVER_VERSION_ERROR_2
,
new
String
[]
{
""
+
version
,
""
+
Constants
.
TCP_DRIVER_VERSION
}
,
null
);
new
String
[]
{
""
+
version
,
""
+
Constants
.
TCP_DRIVER_VERSION
});
}
}
String
db
=
transfer
.
readString
();
String
db
=
transfer
.
readString
();
String
originalURL
=
transfer
.
readString
();
String
originalURL
=
transfer
.
readString
();
...
...
h2/src/main/org/h2/server/ftp/FtpServer.java
浏览文件 @
be1fb4db
...
@@ -21,6 +21,7 @@ import java.util.HashMap;
...
@@ -21,6 +21,7 @@ import java.util.HashMap;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Properties
;
import
java.util.Properties
;
import
org.h2.Driver
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.server.Service
;
import
org.h2.server.Service
;
import
org.h2.util.FileUtils
;
import
org.h2.util.FileUtils
;
...
@@ -177,8 +178,13 @@ public class FtpServer implements Service {
...
@@ -177,8 +178,13 @@ public class FtpServer implements Service {
}
}
}
}
if
(
root
.
startsWith
(
"jdbc:"
))
{
if
(
root
.
startsWith
(
"jdbc:"
))
{
org
.
h2
.
Driver
.
load
();
Connection
conn
;
Connection
conn
=
DriverManager
.
getConnection
(
root
);
if
(
root
.
startsWith
(
"jdbc:h2:"
))
{
// avoid using DriverManager if possible
conn
=
Driver
.
load
().
connect
(
root
,
new
Properties
());
}
else
{
conn
=
DriverManager
.
getConnection
(
root
);
}
db
=
new
FileSystemDatabase
(
conn
,
log
);
db
=
new
FileSystemDatabase
(
conn
,
log
);
root
=
"/"
;
root
=
"/"
;
}
}
...
...
h2/src/main/org/h2/server/web/PageParser.java
浏览文件 @
be1fb4db
...
@@ -6,21 +6,22 @@ package org.h2.server.web;
...
@@ -6,21 +6,22 @@ package org.h2.server.web;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
PageParser
{
public
class
PageParser
{
private
WebServer
server
;
private
WebServer
server
;
private
String
page
;
private
String
page
;
private
int
pos
;
private
int
pos
;
private
Hash
Map
settings
;
private
Map
settings
;
private
int
len
;
private
int
len
;
private
StringBuffer
result
;
private
StringBuffer
result
;
public
static
String
parse
(
WebServer
server
,
String
page
,
Hash
Map
settings
)
{
public
static
String
parse
(
WebServer
server
,
String
page
,
Map
settings
)
{
PageParser
block
=
new
PageParser
(
server
,
page
,
settings
,
0
);
PageParser
block
=
new
PageParser
(
server
,
page
,
settings
,
0
);
return
block
.
parse
();
return
block
.
parse
();
}
}
private
PageParser
(
WebServer
server
,
String
page
,
Hash
Map
settings
,
int
pos
)
{
private
PageParser
(
WebServer
server
,
String
page
,
Map
settings
,
int
pos
)
{
this
.
server
=
server
;
this
.
server
=
server
;
this
.
page
=
page
;
this
.
page
=
page
;
this
.
pos
=
pos
;
this
.
pos
=
pos
;
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
be1fb4db
...
@@ -56,6 +56,7 @@ public class WebServer implements Service {
...
@@ -56,6 +56,7 @@ public class WebServer implements Service {
};
};
private
static
final
String
[]
GENERIC
=
new
String
[]
{
private
static
final
String
[]
GENERIC
=
new
String
[]
{
"Generic JNDI Data Source|javax.naming.InitialContext|java:comp/env/jdbc/Test|sa"
,
"Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc:firebirdsql:localhost:c:/temp/firebird/test|sysdba"
,
"Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc:firebirdsql:localhost:c:/temp/firebird/test|sysdba"
,
"Generic OneDollarDB|in.co.daffodil.db.jdbc.DaffodilDBDriver|jdbc:daffodilDB_embedded:school;path=C:/temp;create=true|sa"
,
"Generic OneDollarDB|in.co.daffodil.db.jdbc.DaffodilDBDriver|jdbc:daffodilDB_embedded:school;path=C:/temp;create=true|sa"
,
"Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|jdbc:db2://<host>/<db>|"
,
"Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|jdbc:db2://<host>/<db>|"
,
...
@@ -67,6 +68,7 @@ public class WebServer implements Service {
...
@@ -67,6 +68,7 @@ public class WebServer implements Service {
"Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc:derby:test;create=true|sa"
,
"Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc:derby:test;create=true|sa"
,
"Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc:derby://localhost:1527/test;create=true|sa"
,
"Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc:derby://localhost:1527/test;create=true|sa"
,
"Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa"
,
"Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa"
,
// this will be listed on top for new installations
"Generic H2|org.h2.Driver|jdbc:h2:~/test|sa"
,
"Generic H2|org.h2.Driver|jdbc:h2:~/test|sa"
,
};
};
...
...
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
be1fb4db
...
@@ -108,7 +108,7 @@ public class TableLink extends Table {
...
@@ -108,7 +108,7 @@ public class TableLink extends Table {
columnMap
.
put
(
n
,
col
);
columnMap
.
put
(
n
,
col
);
}
}
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
new
String
[]{
originalTable
},
e
);
throw
Message
.
getSQLException
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
new
String
[]{
originalTable
+
"("
+
e
.
toString
()
+
")"
},
e
);
}
finally
{
}
finally
{
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
stat
);
}
}
...
...
h2/src/main/org/h2/tools/RunScriptThread.java
浏览文件 @
be1fb4db
...
@@ -9,7 +9,6 @@ import java.sql.SQLException;
...
@@ -9,7 +9,6 @@ import java.sql.SQLException;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.message.Message
;
class
RunScriptThread
extends
Thread
{
class
RunScriptThread
extends
Thread
{
private
int
id
;
private
int
id
;
...
...
h2/src/main/org/h2/util/ByteUtils.java
浏览文件 @
be1fb4db
...
@@ -170,7 +170,7 @@ public class ByteUtils {
...
@@ -170,7 +170,7 @@ public class ByteUtils {
os
.
writeObject
(
obj
);
os
.
writeObject
(
obj
);
return
out
.
toByteArray
();
return
out
.
toByteArray
();
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
SERIALIZATION_FAILED
,
null
,
e
);
throw
Message
.
getSQLException
(
ErrorCode
.
SERIALIZATION_FAILED
_1
,
new
String
[]{
e
.
toString
()}
,
e
);
}
}
}
}
...
@@ -181,7 +181,7 @@ public class ByteUtils {
...
@@ -181,7 +181,7 @@ public class ByteUtils {
Object
obj
=
is
.
readObject
();
Object
obj
=
is
.
readObject
();
return
obj
;
return
obj
;
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
DESERIALIZATION_FAILED
,
null
,
e
);
throw
Message
.
getSQLException
(
ErrorCode
.
DESERIALIZATION_FAILED
_1
,
new
String
[]{
e
.
toString
()}
,
e
);
}
}
}
}
...
...
h2/src/main/org/h2/util/DateTimeUtils.java
浏览文件 @
be1fb4db
...
@@ -211,7 +211,7 @@ public class DateTimeUtils {
...
@@ -211,7 +211,7 @@ public class DateTimeUtils {
throw
Message
.
getInternalError
(
"type:"
+
type
);
throw
Message
.
getInternalError
(
"type:"
+
type
);
}
}
}
catch
(
IllegalArgumentException
e
)
{
}
catch
(
IllegalArgumentException
e
)
{
throw
Message
.
getSQLException
(
errorCode
,
new
String
[]{
original
},
e
);
throw
Message
.
getSQLException
(
errorCode
,
new
String
[]{
original
,
e
.
toString
()
},
e
);
}
}
}
}
...
...
h2/src/main/org/h2/util/FileUtils.java
浏览文件 @
be1fb4db
...
@@ -142,10 +142,10 @@ public class FileUtils {
...
@@ -142,10 +142,10 @@ public class FileUtils {
throw
Message
.
getInternalError
(
"rename file old=new"
);
throw
Message
.
getInternalError
(
"rename file old=new"
);
}
}
if
(!
oldFile
.
exists
())
{
if
(!
oldFile
.
exists
())
{
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
+
" (not found)"
,
newName
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
+
" (not found)"
,
newName
});
}
}
if
(
newFile
.
exists
())
{
if
(
newFile
.
exists
())
{
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
,
newName
+
" (exists)"
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
,
newName
+
" (exists)"
});
}
}
for
(
int
i
=
0
;
i
<
SysProperties
.
MAX_FILE_RETRY
;
i
++)
{
for
(
int
i
=
0
;
i
<
SysProperties
.
MAX_FILE_RETRY
;
i
++)
{
trace
(
"rename"
,
oldName
+
" >"
+
newName
,
null
);
trace
(
"rename"
,
oldName
+
" >"
+
newName
,
null
);
...
@@ -155,7 +155,7 @@ public class FileUtils {
...
@@ -155,7 +155,7 @@ public class FileUtils {
}
}
wait
(
i
);
wait
(
i
);
}
}
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
,
newName
}
,
null
);
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]{
oldName
,
newName
});
}
}
public
static
synchronized
Properties
loadProperties
(
String
fileName
)
throws
IOException
{
public
static
synchronized
Properties
loadProperties
(
String
fileName
)
throws
IOException
{
...
...
h2/src/main/org/h2/util/IntArray.java
浏览文件 @
be1fb4db
...
@@ -196,6 +196,7 @@ public class IntArray {
...
@@ -196,6 +196,7 @@ public class IntArray {
}
}
public
void
sort
()
{
public
void
sort
()
{
// insertion sort
for
(
int
i
=
1
,
j
;
i
<
size
();
i
++)
{
for
(
int
i
=
1
,
j
;
i
<
size
();
i
++)
{
int
t
=
get
(
i
);
int
t
=
get
(
i
);
for
(
j
=
i
-
1
;
j
>=
0
&&
(
get
(
j
)
>
t
);
j
--)
{
for
(
j
=
i
-
1
;
j
>=
0
&&
(
get
(
j
)
>
t
);
j
--)
{
...
...
h2/src/main/org/h2/util/JdbcUtils.java
浏览文件 @
be1fb4db
...
@@ -11,6 +11,9 @@ import java.sql.SQLException;
...
@@ -11,6 +11,9 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.sql.Statement
;
//#ifdef JDK14
//#ifdef JDK14
import
javax.naming.Context
;
import
javax.naming.NamingException
;
import
javax.sql.DataSource
;
import
javax.sql.XAConnection
;
import
javax.sql.XAConnection
;
//#endif
//#endif
...
@@ -72,7 +75,26 @@ public class JdbcUtils {
...
@@ -72,7 +75,26 @@ public class JdbcUtils {
public
static
Connection
getConnection
(
String
driver
,
String
url
,
String
user
,
String
password
)
throws
SQLException
{
public
static
Connection
getConnection
(
String
driver
,
String
url
,
String
user
,
String
password
)
throws
SQLException
{
if
(!
StringUtils
.
isNullOrEmpty
(
driver
))
{
if
(!
StringUtils
.
isNullOrEmpty
(
driver
))
{
try
{
try
{
ClassUtils
.
loadClass
(
driver
);
Class
d
=
ClassUtils
.
loadClass
(
driver
);
if
(
java
.
sql
.
Driver
.
class
.
isAssignableFrom
(
d
))
{
return
DriverManager
.
getConnection
(
url
,
user
,
password
);
}
else
if
(
javax
.
naming
.
Context
.
class
.
isAssignableFrom
(
d
))
{
// JNDI context
try
{
Context
context
=
(
Context
)
d
.
newInstance
();
DataSource
ds
=
(
DataSource
)
context
.
lookup
(
url
);
return
ds
.
getConnection
(
user
,
password
);
}
catch
(
InstantiationException
e
)
{
throw
Message
.
convert
(
e
);
}
catch
(
IllegalAccessException
e
)
{
throw
Message
.
convert
(
e
);
}
catch
(
NamingException
e
)
{
throw
Message
.
convert
(
e
);
}
}
else
{
// Don't know, but maybe it loaded a JDBC Driver
return
DriverManager
.
getConnection
(
url
,
user
,
password
);
}
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
CLASS_NOT_FOUND_1
,
new
String
[]{
driver
},
e
);
throw
Message
.
getSQLException
(
ErrorCode
.
CLASS_NOT_FOUND_1
,
new
String
[]{
driver
},
e
);
}
}
...
...
h2/src/main/org/h2/util/NetUtils.java
浏览文件 @
be1fb4db
...
@@ -51,7 +51,7 @@ public class NetUtils {
...
@@ -51,7 +51,7 @@ public class NetUtils {
return
new
ServerSocket
(
port
);
return
new
ServerSocket
(
port
);
}
}
}
catch
(
BindException
be
)
{
}
catch
(
BindException
be
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
EXCEPTION_OPENING_PORT_
1
,
new
String
[]{
""
+
port
},
be
);
throw
Message
.
getSQLException
(
ErrorCode
.
EXCEPTION_OPENING_PORT_
2
,
new
String
[]{
""
+
port
,
be
.
toString
()
},
be
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convertIOException
(
e
,
"port: "
+
port
+
" ssl: "
+
ssl
);
throw
Message
.
convertIOException
(
e
,
"port: "
+
port
+
" ssl: "
+
ssl
);
}
}
...
...
h2/src/main/org/h2/util/ObjectArray.java
浏览文件 @
be1fb4db
...
@@ -166,9 +166,11 @@ public class ObjectArray {
...
@@ -166,9 +166,11 @@ public class ObjectArray {
}
}
private
void
sort
(
Comparator
comp
,
int
l
,
int
r
)
{
private
void
sort
(
Comparator
comp
,
int
l
,
int
r
)
{
// quicksort
int
i
,
j
;
int
i
,
j
;
while
(
r
-
l
>
10
)
{
while
(
r
-
l
>
10
)
{
i
=
(
r
+
l
)
>>
1
;
// randomized pivot to avoid worst case
i
=
RandomUtils
.
nextInt
(
r
-
l
-
4
)
+
l
+
2
;
if
(
comp
.
compare
(
get
(
l
),
get
(
r
))
>
0
)
{
if
(
comp
.
compare
(
get
(
l
),
get
(
r
))
>
0
)
{
swap
(
l
,
r
);
swap
(
l
,
r
);
}
}
...
...
h2/src/main/org/h2/value/ValueDate.java
浏览文件 @
be1fb4db
...
@@ -9,7 +9,6 @@ import java.sql.PreparedStatement;
...
@@ -9,7 +9,6 @@ import java.sql.PreparedStatement;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.message.Message
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.DateTimeUtils
;
/**
/**
...
@@ -25,7 +24,7 @@ public class ValueDate extends Value {
...
@@ -25,7 +24,7 @@ public class ValueDate extends Value {
}
}
public
static
Date
parseDate
(
String
s
)
throws
SQLException
{
public
static
Date
parseDate
(
String
s
)
throws
SQLException
{
return
(
Date
)
DateTimeUtils
.
parseDateTime
(
s
,
Value
.
DATE
,
ErrorCode
.
DATE_CONSTANT_
1
);
return
(
Date
)
DateTimeUtils
.
parseDateTime
(
s
,
Value
.
DATE
,
ErrorCode
.
DATE_CONSTANT_
2
);
}
}
public
Date
getDate
()
{
public
Date
getDate
()
{
...
...
h2/src/main/org/h2/value/ValueDecimal.java
浏览文件 @
be1fb4db
...
@@ -35,7 +35,7 @@ public class ValueDecimal extends Value {
...
@@ -35,7 +35,7 @@ public class ValueDecimal extends Value {
if
(
value
==
null
)
{
if
(
value
==
null
)
{
throw
new
IllegalArgumentException
();
throw
new
IllegalArgumentException
();
}
else
if
(!
SysProperties
.
ALLOW_BIG_DECIMAL_EXTENSIONS
&&
!
value
.
getClass
().
equals
(
BigDecimal
.
class
))
{
}
else
if
(!
SysProperties
.
ALLOW_BIG_DECIMAL_EXTENSIONS
&&
!
value
.
getClass
().
equals
(
BigDecimal
.
class
))
{
SQLException
e
=
Message
.
getSQLException
(
ErrorCode
.
INVALID_CLASS_2
,
new
String
[]{
BigDecimal
.
class
.
getName
(),
value
.
getClass
().
getName
()}
,
null
);
SQLException
e
=
Message
.
getSQLException
(
ErrorCode
.
INVALID_CLASS_2
,
new
String
[]{
BigDecimal
.
class
.
getName
(),
value
.
getClass
().
getName
()});
throw
Message
.
convertToInternal
(
e
);
throw
Message
.
convertToInternal
(
e
);
}
}
this
.
value
=
value
;
this
.
value
=
value
;
...
...
h2/src/main/org/h2/value/ValueString.java
浏览文件 @
be1fb4db
...
@@ -23,7 +23,8 @@ public class ValueString extends ValueStringBase {
...
@@ -23,7 +23,8 @@ public class ValueString extends ValueStringBase {
}
}
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
ValueString
v
=
(
ValueString
)
o
;
// compatibility: the other object could be ValueStringFixed
ValueStringBase
v
=
(
ValueStringBase
)
o
;
return
mode
.
compareString
(
value
,
v
.
value
,
false
);
return
mode
.
compareString
(
value
,
v
.
value
,
false
);
}
}
...
...
h2/src/main/org/h2/value/ValueStringFixed.java
浏览文件 @
be1fb4db
...
@@ -18,7 +18,8 @@ public class ValueStringFixed extends ValueStringBase {
...
@@ -18,7 +18,8 @@ public class ValueStringFixed extends ValueStringBase {
}
}
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
throws
SQLException
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
throws
SQLException
{
ValueStringFixed
v
=
(
ValueStringFixed
)
o
;
// compatibility: the other object could be ValueString
ValueStringBase
v
=
(
ValueStringBase
)
o
;
return
mode
.
compareString
(
value
,
v
.
value
,
false
);
return
mode
.
compareString
(
value
,
v
.
value
,
false
);
}
}
...
...
h2/src/main/org/h2/value/ValueTime.java
浏览文件 @
be1fb4db
...
@@ -19,7 +19,7 @@ public class ValueTime extends Value {
...
@@ -19,7 +19,7 @@ public class ValueTime extends Value {
}
}
public
static
Time
parseTime
(
String
s
)
throws
SQLException
{
public
static
Time
parseTime
(
String
s
)
throws
SQLException
{
return
(
Time
)
DateTimeUtils
.
parseDateTime
(
s
,
Value
.
TIME
,
ErrorCode
.
TIME_CONSTANT_
1
);
return
(
Time
)
DateTimeUtils
.
parseDateTime
(
s
,
Value
.
TIME
,
ErrorCode
.
TIME_CONSTANT_
2
);
}
}
public
Time
getTime
()
{
public
Time
getTime
()
{
...
...
h2/src/main/org/h2/value/ValueTimestamp.java
浏览文件 @
be1fb4db
...
@@ -36,7 +36,7 @@ public class ValueTimestamp extends Value {
...
@@ -36,7 +36,7 @@ public class ValueTimestamp extends Value {
}
}
public
static
Timestamp
parseTimestamp
(
String
s
)
throws
SQLException
{
public
static
Timestamp
parseTimestamp
(
String
s
)
throws
SQLException
{
return
(
Timestamp
)
DateTimeUtils
.
parseDateTime
(
s
,
Value
.
TIMESTAMP
,
ErrorCode
.
TIMESTAMP_CONSTANT_
1
);
return
(
Timestamp
)
DateTimeUtils
.
parseDateTime
(
s
,
Value
.
TIMESTAMP
,
ErrorCode
.
TIMESTAMP_CONSTANT_
2
);
}
}
public
int
getType
()
{
public
int
getType
()
{
...
...
h2/src/test/org/h2/test/unit/TestIntArray.java
浏览文件 @
be1fb4db
...
@@ -6,13 +6,16 @@ package org.h2.test.unit;
...
@@ -6,13 +6,16 @@ package org.h2.test.unit;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.util.IntArray
;
import
org.h2.util.IntArray
;
public
class
TestIntArray
extends
TestBase
{
public
class
TestIntArray
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
testRandom
();
}
private
void
testRandom
()
throws
Exception
{
IntArray
array
=
new
IntArray
();
IntArray
array
=
new
IntArray
();
int
[]
test
=
new
int
[
0
];
int
[]
test
=
new
int
[
0
];
Random
random
=
new
Random
(
1
);
Random
random
=
new
Random
(
1
);
...
...
h2/src/tools/org/h2/tools/i18n/PrepareTranslation.java
浏览文件 @
be1fb4db
差异被折叠。
点击展开。
h2/src/tools/org/h2/tools/i18n/PropertiesToUTF8.java
浏览文件 @
be1fb4db
...
@@ -19,7 +19,11 @@ import org.h2.util.StringUtils;
...
@@ -19,7 +19,11 @@ import org.h2.util.StringUtils;
public
class
PropertiesToUTF8
{
public
class
PropertiesToUTF8
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
[]
list
=
new
File
(
"bin/org/h2/server/web/res"
).
listFiles
();
convert
(
"bin/org/h2/server/web/res"
,
"."
);
}
private
static
void
convert
(
String
source
,
String
target
)
throws
Exception
{
File
[]
list
=
new
File
(
source
).
listFiles
();
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
File
f
=
list
[
i
];
File
f
=
list
[
i
];
if
(!
f
.
getName
().
endsWith
(
".properties"
))
{
if
(!
f
.
getName
().
endsWith
(
".properties"
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论