Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
42715ee9
提交
42715ee9
authored
1月 30, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
9cf66529
显示空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
170 行增加
和
165 行删除
+170
-165
AggregateData.java
h2/src/main/org/h2/expression/AggregateData.java
+1
-0
Comparison.java
h2/src/main/org/h2/expression/Comparison.java
+1
-0
ConditionAndOr.java
h2/src/main/org/h2/expression/ConditionAndOr.java
+1
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+47
-47
BtreeNode.java
h2/src/main/org/h2/index/BtreeNode.java
+4
-4
LinearHashBucket.java
h2/src/main/org/h2/index/LinearHashBucket.java
+4
-4
LinearHashIndex.java
h2/src/main/org/h2/index/LinearHashIndex.java
+1
-1
TreeIndex.java
h2/src/main/org/h2/index/TreeIndex.java
+29
-29
ViewIndex.java
h2/src/main/org/h2/index/ViewIndex.java
+4
-2
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+16
-16
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+9
-9
JdbcPreparedStatement.java
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
+8
-8
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+9
-9
JdbcStatement.java
h2/src/main/org/h2/jdbc/JdbcStatement.java
+3
-3
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+6
-3
Message.java
h2/src/main/org/h2/message/Message.java
+8
-10
help.csv
h2/src/main/org/h2/res/help.csv
+17
-17
messages.properties
h2/src/main/org/h2/res/messages.properties
+2
-2
没有找到文件。
h2/src/main/org/h2/expression/AggregateData.java
浏览文件 @
42715ee9
...
@@ -66,6 +66,7 @@ public class AggregateData {
...
@@ -66,6 +66,7 @@ public class AggregateData {
if
(
value
==
null
)
{
if
(
value
==
null
)
{
value
=
v
;
value
=
v
;
}
else
{
}
else
{
v
=
v
.
convertTo
(
value
.
getType
());
value
=
value
.
add
(
v
);
value
=
value
.
add
(
v
);
}
}
break
;
break
;
...
...
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
42715ee9
...
@@ -78,6 +78,7 @@ public class Comparison extends Condition {
...
@@ -78,6 +78,7 @@ public class Comparison extends Condition {
Function
function
=
Function
.
getFunction
(
session
.
getDatabase
(),
"CAST"
);
Function
function
=
Function
.
getFunction
(
session
.
getDatabase
(),
"CAST"
);
function
.
setParameter
(
0
,
expr
);
function
.
setParameter
(
0
,
expr
);
function
.
setDataType
(
dataType
,
precision
,
scale
);
function
.
setDataType
(
dataType
,
precision
,
scale
);
function
.
doneWithParameters
();
return
function
.
optimize
(
session
);
return
function
.
optimize
(
session
);
}
}
...
...
h2/src/main/org/h2/expression/ConditionAndOr.java
浏览文件 @
42715ee9
...
@@ -97,7 +97,7 @@ public class ConditionAndOr extends Condition {
...
@@ -97,7 +97,7 @@ public class ConditionAndOr extends Condition {
}
}
public
Expression
optimize
(
Session
session
)
throws
SQLException
{
public
Expression
optimize
(
Session
session
)
throws
SQLException
{
// TODO NULL
values
: see http://www-cs-students.stanford.edu/~wlam/compsci/sqlnulls
// TODO NULL: see http://www-cs-students.stanford.edu/~wlam/compsci/sqlnulls
// TODO test if all optimizations are switched off against all on (including performance)
// TODO test if all optimizations are switched off against all on (including performance)
// TODO document NULL exactly for every case
// TODO document NULL exactly for every case
left
=
left
.
optimize
(
session
);
left
=
left
.
optimize
(
session
);
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
42715ee9
...
@@ -91,13 +91,13 @@ public class Function extends Expression implements FunctionCall {
...
@@ -91,13 +91,13 @@ public class Function extends Expression implements FunctionCall {
ARRAY_GET
=
209
,
CSVREAD
=
210
,
CSVWRITE
=
211
,
MEMORY_FREE
=
212
,
ARRAY_GET
=
209
,
CSVREAD
=
210
,
CSVWRITE
=
211
,
MEMORY_FREE
=
212
,
MEMORY_USED
=
213
,
LOCK_MODE
=
214
,
SCHEMA
=
215
,
SESSION_ID
=
216
,
ARRAY_LENGTH
=
217
;
MEMORY_USED
=
213
,
LOCK_MODE
=
214
,
SCHEMA
=
215
,
SESSION_ID
=
216
,
ARRAY_LENGTH
=
217
;
private
static
final
int
VARARGS
=
-
1
;
private
static
final
int
VAR
_
ARGS
=
-
1
;
private
static
HashMap
functions
;
private
static
HashMap
functions
;
private
FunctionInfo
info
;
private
FunctionInfo
info
;
private
Expression
[]
args
;
private
Expression
[]
args
;
private
ObjectArray
var
a
rgs
;
private
ObjectArray
var
A
rgs
;
private
int
dataType
,
scale
;
private
int
dataType
,
scale
;
private
long
precision
;
private
long
precision
;
private
Database
database
;
private
Database
database
;
...
@@ -163,7 +163,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -163,7 +163,7 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"PI"
,
PI
,
0
,
Value
.
DOUBLE
);
addFunction
(
"PI"
,
PI
,
0
,
Value
.
DOUBLE
);
addFunction
(
"POWER"
,
POWER
,
2
,
Value
.
DOUBLE
);
addFunction
(
"POWER"
,
POWER
,
2
,
Value
.
DOUBLE
);
addFunction
(
"RADIANS"
,
RADIANS
,
1
,
Value
.
DOUBLE
);
addFunction
(
"RADIANS"
,
RADIANS
,
1
,
Value
.
DOUBLE
);
addFunctionNotConst
(
"RAND"
,
RAND
,
VARARGS
,
Value
.
DOUBLE
);
// no args: regular rand; with one arg: seed random generator
addFunctionNotConst
(
"RAND"
,
RAND
,
VAR
_
ARGS
,
Value
.
DOUBLE
);
// no args: regular rand; with one arg: seed random generator
addFunction
(
"ROUND"
,
ROUND
,
2
,
Value
.
DOUBLE
);
addFunction
(
"ROUND"
,
ROUND
,
2
,
Value
.
DOUBLE
);
addFunction
(
"ROUNDMAGIC"
,
ROUNDMAGIC
,
1
,
Value
.
DOUBLE
);
addFunction
(
"ROUNDMAGIC"
,
ROUNDMAGIC
,
1
,
Value
.
DOUBLE
);
addFunction
(
"SIGN"
,
SIGN
,
1
,
Value
.
INT
);
addFunction
(
"SIGN"
,
SIGN
,
1
,
Value
.
INT
);
...
@@ -175,7 +175,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -175,7 +175,7 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"ENCRYPT"
,
ENCRYPT
,
3
,
Value
.
BYTES
);
addFunction
(
"ENCRYPT"
,
ENCRYPT
,
3
,
Value
.
BYTES
);
addFunction
(
"DECRYPT"
,
DECRYPT
,
3
,
Value
.
BYTES
);
addFunction
(
"DECRYPT"
,
DECRYPT
,
3
,
Value
.
BYTES
);
addFunctionNotConst
(
"SECURE_RAND"
,
SECURE_RAND
,
1
,
Value
.
BYTES
);
addFunctionNotConst
(
"SECURE_RAND"
,
SECURE_RAND
,
1
,
Value
.
BYTES
);
addFunction
(
"COMPRESS"
,
COMPRESS
,
VARARGS
,
Value
.
BYTES
);
addFunction
(
"COMPRESS"
,
COMPRESS
,
VAR
_
ARGS
,
Value
.
BYTES
);
addFunction
(
"EXPAND"
,
EXPAND
,
1
,
Value
.
BYTES
);
addFunction
(
"EXPAND"
,
EXPAND
,
1
,
Value
.
BYTES
);
addFunction
(
"ZERO"
,
ZERO
,
0
,
Value
.
INT
);
addFunction
(
"ZERO"
,
ZERO
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"RANDOM_UUID"
,
RANDOM_UUID
,
0
,
Value
.
UUID
);
addFunctionNotConst
(
"RANDOM_UUID"
,
RANDOM_UUID
,
0
,
Value
.
UUID
);
...
@@ -186,38 +186,38 @@ public class Function extends Expression implements FunctionCall {
...
@@ -186,38 +186,38 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"CHAR"
,
CHAR
,
1
,
Value
.
STRING
);
addFunction
(
"CHAR"
,
CHAR
,
1
,
Value
.
STRING
);
addFunction
(
"CHAR_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"CHAR_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"CHARACTER_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
// same as CHAR_LENGTH
addFunction
(
"CHARACTER_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
// same as CHAR_LENGTH
addFunctionWithNull
(
"CONCAT"
,
CONCAT
,
VARARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"CONCAT"
,
CONCAT
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"DIFFERENCE"
,
DIFFERENCE
,
2
,
Value
.
INT
);
addFunction
(
"DIFFERENCE"
,
DIFFERENCE
,
2
,
Value
.
INT
);
addFunction
(
"HEXTORAW"
,
HEXTORAW
,
1
,
Value
.
STRING
);
addFunction
(
"HEXTORAW"
,
HEXTORAW
,
1
,
Value
.
STRING
);
addFunctionWithNull
(
"INSERT"
,
INSERT
,
4
,
Value
.
STRING
);
addFunctionWithNull
(
"INSERT"
,
INSERT
,
4
,
Value
.
STRING
);
addFunction
(
"LCASE"
,
LCASE
,
1
,
Value
.
STRING
);
addFunction
(
"LCASE"
,
LCASE
,
1
,
Value
.
STRING
);
addFunction
(
"LEFT"
,
LEFT
,
2
,
Value
.
STRING
);
addFunction
(
"LEFT"
,
LEFT
,
2
,
Value
.
STRING
);
addFunction
(
"LENGTH"
,
LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"LENGTH"
,
LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"LOCATE"
,
LOCATE
,
VARARGS
,
Value
.
INT
);
// 2 or 3 arguments
addFunction
(
"LOCATE"
,
LOCATE
,
VAR
_
ARGS
,
Value
.
INT
);
// 2 or 3 arguments
addFunction
(
"POSITION"
,
LOCATE
,
2
,
Value
.
INT
);
// same as LOCATE with 2 arguments
addFunction
(
"POSITION"
,
LOCATE
,
2
,
Value
.
INT
);
// same as LOCATE with 2 arguments
addFunction
(
"INSTR"
,
INSTR
,
VARARGS
,
Value
.
INT
);
addFunction
(
"INSTR"
,
INSTR
,
VAR
_
ARGS
,
Value
.
INT
);
addFunction
(
"LTRIM"
,
LTRIM
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"LTRIM"
,
LTRIM
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"OCTET_LENGTH"
,
OCTET_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"OCTET_LENGTH"
,
OCTET_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"RAWTOHEX"
,
RAWTOHEX
,
1
,
Value
.
STRING
);
addFunction
(
"RAWTOHEX"
,
RAWTOHEX
,
1
,
Value
.
STRING
);
addFunction
(
"REPEAT"
,
REPEAT
,
2
,
Value
.
STRING
);
addFunction
(
"REPEAT"
,
REPEAT
,
2
,
Value
.
STRING
);
addFunctionWithNull
(
"REPLACE"
,
REPLACE
,
VARARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"REPLACE"
,
REPLACE
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"RIGHT"
,
RIGHT
,
2
,
Value
.
STRING
);
addFunction
(
"RIGHT"
,
RIGHT
,
2
,
Value
.
STRING
);
addFunction
(
"RTRIM"
,
RTRIM
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"RTRIM"
,
RTRIM
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"SOUNDEX"
,
SOUNDEX
,
1
,
Value
.
STRING
);
addFunction
(
"SOUNDEX"
,
SOUNDEX
,
1
,
Value
.
STRING
);
addFunction
(
"SPACE"
,
SPACE
,
1
,
Value
.
STRING
);
addFunction
(
"SPACE"
,
SPACE
,
1
,
Value
.
STRING
);
addFunction
(
"SUBSTR"
,
SUBSTR
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"SUBSTR"
,
SUBSTR
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"SUBSTRING"
,
SUBSTRING
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"SUBSTRING"
,
SUBSTRING
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"UCASE"
,
UCASE
,
1
,
Value
.
STRING
);
addFunction
(
"UCASE"
,
UCASE
,
1
,
Value
.
STRING
);
addFunction
(
"LOWER"
,
LOWER
,
1
,
Value
.
STRING
);
addFunction
(
"LOWER"
,
LOWER
,
1
,
Value
.
STRING
);
addFunction
(
"UPPER"
,
UPPER
,
1
,
Value
.
STRING
);
addFunction
(
"UPPER"
,
UPPER
,
1
,
Value
.
STRING
);
addFunction
(
"POSITION"
,
POSITION
,
2
,
Value
.
INT
);
addFunction
(
"POSITION"
,
POSITION
,
2
,
Value
.
INT
);
addFunction
(
"TRIM"
,
TRIM
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"TRIM"
,
TRIM
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"STRINGENCODE"
,
STRINGENCODE
,
1
,
Value
.
STRING
);
addFunction
(
"STRINGENCODE"
,
STRINGENCODE
,
1
,
Value
.
STRING
);
addFunction
(
"STRINGDECODE"
,
STRINGDECODE
,
1
,
Value
.
STRING
);
addFunction
(
"STRINGDECODE"
,
STRINGDECODE
,
1
,
Value
.
STRING
);
addFunction
(
"STRINGTOUTF8"
,
STRINGTOUTF8
,
1
,
Value
.
BYTES
);
addFunction
(
"STRINGTOUTF8"
,
STRINGTOUTF8
,
1
,
Value
.
BYTES
);
addFunction
(
"UTF8TOSTRING"
,
UTF8TOSTRING
,
1
,
Value
.
STRING
);
addFunction
(
"UTF8TOSTRING"
,
UTF8TOSTRING
,
1
,
Value
.
STRING
);
addFunction
(
"XMLATTR"
,
XMLATTR
,
2
,
Value
.
STRING
);
addFunction
(
"XMLATTR"
,
XMLATTR
,
2
,
Value
.
STRING
);
addFunctionWithNull
(
"XMLNODE"
,
XMLNODE
,
VARARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"XMLNODE"
,
XMLNODE
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"XMLCOMMENT"
,
XMLCOMMENT
,
1
,
Value
.
STRING
);
addFunction
(
"XMLCOMMENT"
,
XMLCOMMENT
,
1
,
Value
.
STRING
);
addFunction
(
"XMLCDATA"
,
XMLCDATA
,
1
,
Value
.
STRING
);
addFunction
(
"XMLCDATA"
,
XMLCDATA
,
1
,
Value
.
STRING
);
addFunction
(
"XMLSTARTDOC"
,
XMLSTARTDOC
,
0
,
Value
.
STRING
);
addFunction
(
"XMLSTARTDOC"
,
XMLSTARTDOC
,
0
,
Value
.
STRING
);
...
@@ -228,8 +228,8 @@ public class Function extends Expression implements FunctionCall {
...
@@ -228,8 +228,8 @@ public class Function extends Expression implements FunctionCall {
addFunctionNotConst
(
"CURDATE"
,
CURDATE
,
0
,
Value
.
DATE
);
addFunctionNotConst
(
"CURDATE"
,
CURDATE
,
0
,
Value
.
DATE
);
addFunctionNotConst
(
"CURRENT_TIME"
,
CURRENT_TIME
,
0
,
Value
.
TIME
);
addFunctionNotConst
(
"CURRENT_TIME"
,
CURRENT_TIME
,
0
,
Value
.
TIME
);
addFunctionNotConst
(
"CURTIME"
,
CURTIME
,
0
,
Value
.
TIME
);
addFunctionNotConst
(
"CURTIME"
,
CURTIME
,
0
,
Value
.
TIME
);
addFunctionNotConst
(
"CURRENT_TIMESTAMP"
,
CURRENT_TIMESTAMP
,
VARARGS
,
Value
.
TIMESTAMP
);
addFunctionNotConst
(
"CURRENT_TIMESTAMP"
,
CURRENT_TIMESTAMP
,
VAR
_
ARGS
,
Value
.
TIMESTAMP
);
addFunctionNotConst
(
"NOW"
,
NOW
,
VARARGS
,
Value
.
TIMESTAMP
);
addFunctionNotConst
(
"NOW"
,
NOW
,
VAR
_
ARGS
,
Value
.
TIMESTAMP
);
addFunction
(
"DATEADD"
,
DATEADD
,
3
,
Value
.
TIMESTAMP
);
addFunction
(
"DATEADD"
,
DATEADD
,
3
,
Value
.
TIMESTAMP
);
addFunction
(
"DATEDIFF"
,
DATEDIFF
,
3
,
Value
.
LONG
);
addFunction
(
"DATEDIFF"
,
DATEDIFF
,
3
,
Value
.
LONG
);
addFunction
(
"DAYNAME"
,
DAYNAME
,
1
,
Value
.
STRING
);
addFunction
(
"DAYNAME"
,
DAYNAME
,
1
,
Value
.
STRING
);
...
@@ -246,8 +246,8 @@ public class Function extends Expression implements FunctionCall {
...
@@ -246,8 +246,8 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"WEEK"
,
WEEK
,
1
,
Value
.
INT
);
addFunction
(
"WEEK"
,
WEEK
,
1
,
Value
.
INT
);
addFunction
(
"YEAR"
,
YEAR
,
1
,
Value
.
INT
);
addFunction
(
"YEAR"
,
YEAR
,
1
,
Value
.
INT
);
addFunction
(
"EXTRACT"
,
EXTRACT
,
2
,
Value
.
INT
);
addFunction
(
"EXTRACT"
,
EXTRACT
,
2
,
Value
.
INT
);
addFunctionWithNull
(
"FORMATDATETIME"
,
FORMATDATETIME
,
VARARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"FORMATDATETIME"
,
FORMATDATETIME
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"PARSEDATETIME"
,
PARSEDATETIME
,
VARARGS
,
Value
.
TIMESTAMP
);
addFunctionWithNull
(
"PARSEDATETIME"
,
PARSEDATETIME
,
VAR
_
ARGS
,
Value
.
TIMESTAMP
);
// system
// system
addFunctionNotConst
(
"DATABASE"
,
DATABASE
,
0
,
Value
.
STRING
);
addFunctionNotConst
(
"DATABASE"
,
DATABASE
,
0
,
Value
.
STRING
);
addFunctionNotConst
(
"USER"
,
USER
,
0
,
Value
.
STRING
);
addFunctionNotConst
(
"USER"
,
USER
,
0
,
Value
.
STRING
);
...
@@ -263,15 +263,15 @@ public class Function extends Expression implements FunctionCall {
...
@@ -263,15 +263,15 @@ public class Function extends Expression implements FunctionCall {
addFunctionWithNull
(
"CASEWHEN"
,
CASEWHEN
,
3
,
Value
.
NULL
);
addFunctionWithNull
(
"CASEWHEN"
,
CASEWHEN
,
3
,
Value
.
NULL
);
addFunctionWithNull
(
"CONVERT"
,
CONVERT
,
1
,
Value
.
NULL
);
addFunctionWithNull
(
"CONVERT"
,
CONVERT
,
1
,
Value
.
NULL
);
addFunctionWithNull
(
"CAST"
,
CAST
,
1
,
Value
.
NULL
);
addFunctionWithNull
(
"CAST"
,
CAST
,
1
,
Value
.
NULL
);
addFunctionWithNull
(
"COALESCE"
,
COALESCE
,
VARARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"COALESCE"
,
COALESCE
,
VAR
_
ARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"NVL"
,
COALESCE
,
VARARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"NVL"
,
COALESCE
,
VAR
_
ARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"NULLIF"
,
NULLIF
,
2
,
Value
.
NULL
);
addFunctionWithNull
(
"NULLIF"
,
NULLIF
,
2
,
Value
.
NULL
);
addFunctionWithNull
(
"CASE"
,
CASE
,
VARARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"CASE"
,
CASE
,
VAR
_
ARGS
,
Value
.
NULL
);
addFunctionNotConst
(
"NEXTVAL"
,
NEXTVAL
,
VARARGS
,
Value
.
LONG
);
addFunctionNotConst
(
"NEXTVAL"
,
NEXTVAL
,
VAR
_
ARGS
,
Value
.
LONG
);
addFunctionNotConst
(
"CURRVAL"
,
CURRVAL
,
VARARGS
,
Value
.
LONG
);
addFunctionNotConst
(
"CURRVAL"
,
CURRVAL
,
VAR
_
ARGS
,
Value
.
LONG
);
addFunction
(
"ARRAY_GET"
,
ARRAY_GET
,
2
,
Value
.
NULL
);
addFunction
(
"ARRAY_GET"
,
ARRAY_GET
,
2
,
Value
.
NULL
);
addFunction
(
"CSVREAD"
,
CSVREAD
,
VARARGS
,
Value
.
RESULT_SET
,
false
,
false
);
addFunction
(
"CSVREAD"
,
CSVREAD
,
VAR
_
ARGS
,
Value
.
RESULT_SET
,
false
,
false
);
addFunction
(
"CSVWRITE"
,
CSVWRITE
,
VARARGS
,
Value
.
NULL
,
false
,
false
);
addFunction
(
"CSVWRITE"
,
CSVWRITE
,
VAR
_
ARGS
,
Value
.
NULL
,
false
,
false
);
addFunctionNotConst
(
"MEMORY_FREE"
,
MEMORY_FREE
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"MEMORY_FREE"
,
MEMORY_FREE
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"MEMORY_USED"
,
MEMORY_USED
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"MEMORY_USED"
,
MEMORY_USED
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"LOCK_MODE"
,
LOCK_MODE
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"LOCK_MODE"
,
LOCK_MODE
,
0
,
Value
.
INT
);
...
@@ -318,16 +318,16 @@ public class Function extends Expression implements FunctionCall {
...
@@ -318,16 +318,16 @@ public class Function extends Expression implements FunctionCall {
private
Function
(
Database
database
,
FunctionInfo
info
)
{
private
Function
(
Database
database
,
FunctionInfo
info
)
{
this
.
database
=
database
;
this
.
database
=
database
;
this
.
info
=
info
;
this
.
info
=
info
;
if
(
info
.
parameterCount
==
VARARGS
)
{
if
(
info
.
parameterCount
==
VAR
_
ARGS
)
{
var
a
rgs
=
new
ObjectArray
();
var
A
rgs
=
new
ObjectArray
();
}
else
{
}
else
{
args
=
new
Expression
[
info
.
parameterCount
];
args
=
new
Expression
[
info
.
parameterCount
];
}
}
}
}
public
void
setParameter
(
int
index
,
Expression
param
)
throws
SQLException
{
public
void
setParameter
(
int
index
,
Expression
param
)
throws
SQLException
{
if
(
var
a
rgs
!=
null
)
{
if
(
var
A
rgs
!=
null
)
{
var
a
rgs
.
add
(
param
);
var
A
rgs
.
add
(
param
);
}
else
{
}
else
{
if
(
index
>=
args
.
length
)
{
if
(
index
>=
args
.
length
)
{
throw
Message
.
getSQLException
(
Message
.
INVALID_PARAMETER_COUNT_1
,
""
+
args
.
length
);
throw
Message
.
getSQLException
(
Message
.
INVALID_PARAMETER_COUNT_1
,
""
+
args
.
length
);
...
@@ -914,7 +914,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -914,7 +914,7 @@ public class Function extends Expression implements FunctionCall {
int
field
=
getDatePart
(
part
);
int
field
=
getDatePart
(
part
);
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
long
t1
=
d1
.
getTime
(),
t2
=
d2
.
getTime
();
long
t1
=
d1
.
getTime
(),
t2
=
d2
.
getTime
();
// need to convert to UTC, otherwise we get inconsistent results with certain timezones (those that are 30 min
i
tes off)
// need to convert to UTC, otherwise we get inconsistent results with certain timezones (those that are 30 min
u
tes off)
TimeZone
zone
=
calendar
.
getTimeZone
();
TimeZone
zone
=
calendar
.
getTimeZone
();
calendar
.
setTime
(
d1
);
calendar
.
setTime
(
d1
);
t1
+=
zone
.
getOffset
(
calendar
.
get
(
Calendar
.
ERA
),
calendar
.
get
(
Calendar
.
YEAR
),
calendar
.
get
(
Calendar
.
MONTH
),
t1
+=
zone
.
getOffset
(
calendar
.
get
(
Calendar
.
ERA
),
calendar
.
get
(
Calendar
.
YEAR
),
calendar
.
get
(
Calendar
.
MONTH
),
...
@@ -987,12 +987,12 @@ public class Function extends Expression implements FunctionCall {
...
@@ -987,12 +987,12 @@ public class Function extends Expression implements FunctionCall {
s
=
(
i
==
0
)
?
s
:
s
.
substring
(
i
);
s
=
(
i
==
0
)
?
s
:
s
.
substring
(
i
);
}
}
if
(
trailing
)
{
if
(
trailing
)
{
int
end
i
ndex
=
s
.
length
()
-
1
;
int
end
I
ndex
=
s
.
length
()
-
1
;
int
i
=
end
i
ndex
;
int
i
=
end
I
ndex
;
while
(
i
>=
0
&&
s
.
charAt
(
i
)
==
space
)
{
while
(
i
>=
0
&&
s
.
charAt
(
i
)
==
space
)
{
i
--;
i
--;
}
}
s
=
i
==
end
i
ndex
?
s
:
s
.
substring
(
0
,
i
+
1
);
s
=
i
==
end
I
ndex
?
s
:
s
.
substring
(
0
,
i
+
1
);
}
}
return
s
;
return
s
;
}
}
...
@@ -1149,21 +1149,21 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1149,21 +1149,21 @@ public class Function extends Expression implements FunctionCall {
private
static
String
getSoundex
(
String
s
)
{
private
static
String
getSoundex
(
String
s
)
{
int
len
=
s
.
length
();
int
len
=
s
.
length
();
char
[]
chars
=
new
char
[]
{
'0'
,
'0'
,
'0'
,
'0'
};
char
[]
chars
=
new
char
[]
{
'0'
,
'0'
,
'0'
,
'0'
};
char
last
d
igit
=
'0'
;
char
last
D
igit
=
'0'
;
for
(
int
i
=
0
,
j
=
0
;
i
<
len
&&
j
<
4
;
i
++)
{
for
(
int
i
=
0
,
j
=
0
;
i
<
len
&&
j
<
4
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
char
c
=
s
.
charAt
(
i
);
char
new
d
igit
=
c
>
SOUNDEX_INDEX
.
length
?
0
:
SOUNDEX_INDEX
[
c
];
char
new
D
igit
=
c
>
SOUNDEX_INDEX
.
length
?
0
:
SOUNDEX_INDEX
[
c
];
if
(
new
d
igit
!=
0
)
{
if
(
new
D
igit
!=
0
)
{
if
(
j
==
0
)
{
if
(
j
==
0
)
{
chars
[
j
++]
=
c
;
chars
[
j
++]
=
c
;
last
digit
=
newd
igit
;
last
Digit
=
newD
igit
;
}
else
if
(
new
d
igit
<=
'6'
)
{
}
else
if
(
new
D
igit
<=
'6'
)
{
if
(
new
digit
!=
lastd
igit
)
{
if
(
new
Digit
!=
lastD
igit
)
{
chars
[
j
++]
=
new
d
igit
;
chars
[
j
++]
=
new
D
igit
;
last
digit
=
newd
igit
;
last
Digit
=
newD
igit
;
}
}
}
else
if
(
new
d
igit
==
'7'
)
{
}
else
if
(
new
D
igit
==
'7'
)
{
last
digit
=
newd
igit
;
last
Digit
=
newD
igit
;
}
}
}
}
}
}
...
@@ -1181,8 +1181,8 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1181,8 +1181,8 @@ public class Function extends Expression implements FunctionCall {
}
}
public
void
doneWithParameters
()
throws
SQLException
{
public
void
doneWithParameters
()
throws
SQLException
{
if
(
info
.
parameterCount
==
VARARGS
)
{
if
(
info
.
parameterCount
==
VAR
_
ARGS
)
{
int
len
=
var
a
rgs
.
size
();
int
len
=
var
A
rgs
.
size
();
int
min
=
0
,
max
=
Integer
.
MAX_VALUE
;
int
min
=
0
,
max
=
Integer
.
MAX_VALUE
;
switch
(
info
.
type
)
{
switch
(
info
.
type
)
{
case
COALESCE:
case
COALESCE:
...
@@ -1239,8 +1239,8 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1239,8 +1239,8 @@ public class Function extends Expression implements FunctionCall {
throw
Message
.
getSQLException
(
Message
.
INVALID_PARAMETER_COUNT_1
,
min
+
".."
+
max
);
throw
Message
.
getSQLException
(
Message
.
INVALID_PARAMETER_COUNT_1
,
min
+
".."
+
max
);
}
}
args
=
new
Expression
[
len
];
args
=
new
Expression
[
len
];
var
a
rgs
.
toArray
(
args
);
var
A
rgs
.
toArray
(
args
);
var
a
rgs
=
null
;
var
A
rgs
=
null
;
}
else
{
}
else
{
int
len
=
args
.
length
;
int
len
=
args
.
length
;
if
(
len
>
0
&&
args
[
len
-
1
]
==
null
)
{
if
(
len
>
0
&&
args
[
len
-
1
]
==
null
)
{
...
...
h2/src/main/org/h2/index/BtreeNode.java
浏览文件 @
42715ee9
...
@@ -358,12 +358,12 @@ public class BtreeNode extends BtreePage {
...
@@ -358,12 +358,12 @@ public class BtreeNode extends BtreePage {
String
first
=
null
;
String
first
=
null
;
String
last
=
null
;
String
last
=
null
;
for
(
int
i
=
0
;
i
<
pageChildren
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
pageChildren
.
size
();
i
++)
{
String
first
n
ow
=
index
.
getPage
(
pageChildren
.
get
(
i
)).
print
(
indent
+
" "
);
String
first
N
ow
=
index
.
getPage
(
pageChildren
.
get
(
i
)).
print
(
indent
+
" "
);
if
(
first
==
null
)
{
if
(
first
==
null
)
{
first
=
first
n
ow
;
first
=
first
N
ow
;
}
}
if
(
last
!=
null
&&
!
last
.
equals
(
first
n
ow
))
{
if
(
last
!=
null
&&
!
last
.
equals
(
first
N
ow
))
{
System
.
out
.
println
(
"STOP!!! "
+
last
+
" first
now:"
+
firstn
ow
);
System
.
out
.
println
(
"STOP!!! "
+
last
+
" first
Now:"
+
firstN
ow
);
}
}
if
(
i
<
pageData
.
size
())
{
if
(
i
<
pageData
.
size
())
{
String
now
=
getData
(
i
).
getValue
(
1
).
getString
().
substring
(
4150
);
String
now
=
getData
(
i
).
getValue
(
1
).
getString
().
substring
(
4150
);
...
...
h2/src/main/org/h2/index/LinearHashBucket.java
浏览文件 @
42715ee9
...
@@ -104,19 +104,19 @@ public class LinearHashBucket extends Record {
...
@@ -104,19 +104,19 @@ public class LinearHashBucket extends Record {
public
int
getRealByteCount
(
DataPage
dummy
)
throws
SQLException
{
public
int
getRealByteCount
(
DataPage
dummy
)
throws
SQLException
{
int
size
=
2
+
dummy
.
getIntLen
()
+
dummy
.
getIntLen
();
int
size
=
2
+
dummy
.
getIntLen
()
+
dummy
.
getIntLen
();
int
data
s
ize
=
0
;
int
data
S
ize
=
0
;
for
(
int
i
=
0
;
i
<
records
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
records
.
size
();
i
++)
{
LinearHashEntry
record
=
(
LinearHashEntry
)
records
.
get
(
i
);
LinearHashEntry
record
=
(
LinearHashEntry
)
records
.
get
(
i
);
// TODO index: just add the hash if the key is too large
// TODO index: just add the hash if the key is too large
data
s
ize
+=
dummy
.
getValueLen
(
record
.
key
);
data
S
ize
+=
dummy
.
getValueLen
(
record
.
key
);
size
+=
2
*
dummy
.
getIntLen
();
size
+=
2
*
dummy
.
getIntLen
();
}
}
if
(
size
+
data
s
ize
>=
index
.
getBucketSize
())
{
if
(
size
+
data
S
ize
>=
index
.
getBucketSize
())
{
writePos
=
true
;
writePos
=
true
;
return
size
;
return
size
;
}
else
{
}
else
{
writePos
=
false
;
writePos
=
false
;
return
size
+
data
s
ize
;
return
size
+
data
S
ize
;
}
}
}
}
...
...
h2/src/main/org/h2/index/LinearHashIndex.java
浏览文件 @
42715ee9
...
@@ -262,7 +262,7 @@ public class LinearHashIndex extends Index implements RecordReader {
...
@@ -262,7 +262,7 @@ public class LinearHashIndex extends Index implements RecordReader {
// (and it would be an error to set next to -1)
// (and it would be an error to set next to -1)
moveOut
(
session
,
foreign
,
storeIn
);
moveOut
(
session
,
foreign
,
storeIn
);
if
(
Constants
.
CHECK
&&
getBucket
(
foreign
).
getNextBucket
()
!=
-
1
)
{
if
(
Constants
.
CHECK
&&
getBucket
(
foreign
).
getNextBucket
()
!=
-
1
)
{
throw
Message
.
getInternalError
(
"move
o
ut "
+
foreign
);
throw
Message
.
getInternalError
(
"move
O
ut "
+
foreign
);
}
}
return
;
return
;
}
}
...
...
h2/src/main/org/h2/index/TreeIndex.java
浏览文件 @
42715ee9
...
@@ -34,7 +34,7 @@ public class TreeIndex extends Index {
...
@@ -34,7 +34,7 @@ public class TreeIndex extends Index {
public
void
add
(
Session
session
,
Row
row
)
throws
SQLException
{
public
void
add
(
Session
session
,
Row
row
)
throws
SQLException
{
TreeNode
i
=
new
TreeNode
(
row
);
TreeNode
i
=
new
TreeNode
(
row
);
TreeNode
n
=
root
,
x
=
n
;
TreeNode
n
=
root
,
x
=
n
;
boolean
is
l
eft
=
true
;
boolean
is
L
eft
=
true
;
while
(
true
)
{
while
(
true
)
{
if
(
n
==
null
)
{
if
(
n
==
null
)
{
if
(
x
==
null
)
{
if
(
x
==
null
)
{
...
@@ -42,7 +42,7 @@ public class TreeIndex extends Index {
...
@@ -42,7 +42,7 @@ public class TreeIndex extends Index {
rowCount
++;
rowCount
++;
return
;
return
;
}
}
set
(
x
,
is
l
eft
,
i
);
set
(
x
,
is
L
eft
,
i
);
break
;
break
;
}
}
Row
r
=
n
.
row
;
Row
r
=
n
.
row
;
...
@@ -55,17 +55,17 @@ public class TreeIndex extends Index {
...
@@ -55,17 +55,17 @@ public class TreeIndex extends Index {
}
}
compare
=
compareKeys
(
row
,
r
);
compare
=
compareKeys
(
row
,
r
);
}
}
is
l
eft
=
compare
<
0
;
is
L
eft
=
compare
<
0
;
x
=
n
;
x
=
n
;
n
=
child
(
x
,
is
l
eft
);
n
=
child
(
x
,
is
L
eft
);
}
}
balance
(
x
,
is
l
eft
);
balance
(
x
,
is
L
eft
);
rowCount
++;
rowCount
++;
}
}
private
void
balance
(
TreeNode
x
,
boolean
is
l
eft
)
{
private
void
balance
(
TreeNode
x
,
boolean
is
L
eft
)
{
while
(
true
)
{
while
(
true
)
{
int
sign
=
is
l
eft
?
1
:
-
1
;
int
sign
=
is
L
eft
?
1
:
-
1
;
switch
(
x
.
balance
*
sign
)
{
switch
(
x
.
balance
*
sign
)
{
case
1
:
case
1
:
x
.
balance
=
0
;
x
.
balance
=
0
;
...
@@ -74,20 +74,20 @@ public class TreeIndex extends Index {
...
@@ -74,20 +74,20 @@ public class TreeIndex extends Index {
x
.
balance
=
-
sign
;
x
.
balance
=
-
sign
;
break
;
break
;
case
-
1
:
case
-
1
:
TreeNode
l
=
child
(
x
,
is
l
eft
);
TreeNode
l
=
child
(
x
,
is
L
eft
);
if
(
l
.
balance
==
-
sign
)
{
if
(
l
.
balance
==
-
sign
)
{
replace
(
x
,
l
);
replace
(
x
,
l
);
set
(
x
,
is
left
,
child
(
l
,
!
isl
eft
));
set
(
x
,
is
Left
,
child
(
l
,
!
isL
eft
));
set
(
l
,
!
is
l
eft
,
x
);
set
(
l
,
!
is
L
eft
,
x
);
x
.
balance
=
0
;
x
.
balance
=
0
;
l
.
balance
=
0
;
l
.
balance
=
0
;
}
else
{
}
else
{
TreeNode
r
=
child
(
l
,
!
is
l
eft
);
TreeNode
r
=
child
(
l
,
!
is
L
eft
);
replace
(
x
,
r
);
replace
(
x
,
r
);
set
(
l
,
!
is
left
,
child
(
r
,
isl
eft
));
set
(
l
,
!
is
Left
,
child
(
r
,
isL
eft
));
set
(
r
,
is
l
eft
,
l
);
set
(
r
,
is
L
eft
,
l
);
set
(
x
,
is
left
,
child
(
r
,
!
isl
eft
));
set
(
x
,
is
Left
,
child
(
r
,
!
isL
eft
));
set
(
r
,
!
is
l
eft
,
x
);
set
(
r
,
!
is
L
eft
,
x
);
int
rb
=
r
.
balance
;
int
rb
=
r
.
balance
;
x
.
balance
=
(
rb
==
-
sign
)
?
sign
:
0
;
x
.
balance
=
(
rb
==
-
sign
)
?
sign
:
0
;
l
.
balance
=
(
rb
==
sign
)
?
-
sign
:
0
;
l
.
balance
=
(
rb
==
sign
)
?
-
sign
:
0
;
...
@@ -98,13 +98,13 @@ public class TreeIndex extends Index {
...
@@ -98,13 +98,13 @@ public class TreeIndex extends Index {
if
(
x
==
root
)
{
if
(
x
==
root
)
{
return
;
return
;
}
}
is
l
eft
=
x
.
isFromLeft
();
is
L
eft
=
x
.
isFromLeft
();
x
=
x
.
parent
;
x
=
x
.
parent
;
}
}
}
}
private
TreeNode
child
(
TreeNode
x
,
boolean
is
l
eft
)
{
private
TreeNode
child
(
TreeNode
x
,
boolean
is
L
eft
)
{
return
is
l
eft
?
x
.
left
:
x
.
right
;
return
is
L
eft
?
x
.
left
:
x
.
right
;
}
}
private
void
replace
(
TreeNode
x
,
TreeNode
n
)
{
private
void
replace
(
TreeNode
x
,
TreeNode
n
)
{
...
@@ -198,12 +198,12 @@ public class TreeIndex extends Index {
...
@@ -198,12 +198,12 @@ public class TreeIndex extends Index {
}
}
rowCount
--;
rowCount
--;
boolean
is
l
eft
=
x
.
isFromLeft
();
boolean
is
L
eft
=
x
.
isFromLeft
();
replace
(
x
,
n
);
replace
(
x
,
n
);
n
=
x
.
parent
;
n
=
x
.
parent
;
while
(
n
!=
null
)
{
while
(
n
!=
null
)
{
x
=
n
;
x
=
n
;
int
sign
=
is
l
eft
?
1
:
-
1
;
int
sign
=
is
L
eft
?
1
:
-
1
;
switch
(
x
.
balance
*
sign
)
{
switch
(
x
.
balance
*
sign
)
{
case
-
1
:
case
-
1
:
x
.
balance
=
0
;
x
.
balance
=
0
;
...
@@ -212,12 +212,12 @@ public class TreeIndex extends Index {
...
@@ -212,12 +212,12 @@ public class TreeIndex extends Index {
x
.
balance
=
sign
;
x
.
balance
=
sign
;
return
;
return
;
case
1
:
case
1
:
TreeNode
r
=
child
(
x
,
!
is
l
eft
);
TreeNode
r
=
child
(
x
,
!
is
L
eft
);
int
b
=
r
.
balance
;
int
b
=
r
.
balance
;
if
(
b
*
sign
>=
0
)
{
if
(
b
*
sign
>=
0
)
{
replace
(
x
,
r
);
replace
(
x
,
r
);
set
(
x
,
!
is
left
,
child
(
r
,
isl
eft
));
set
(
x
,
!
is
Left
,
child
(
r
,
isL
eft
));
set
(
r
,
is
l
eft
,
x
);
set
(
r
,
is
L
eft
,
x
);
if
(
b
==
0
)
{
if
(
b
==
0
)
{
x
.
balance
=
sign
;
x
.
balance
=
sign
;
r
.
balance
=
-
sign
;
r
.
balance
=
-
sign
;
...
@@ -227,20 +227,20 @@ public class TreeIndex extends Index {
...
@@ -227,20 +227,20 @@ public class TreeIndex extends Index {
r
.
balance
=
0
;
r
.
balance
=
0
;
x
=
r
;
x
=
r
;
}
else
{
}
else
{
TreeNode
l
=
child
(
r
,
is
l
eft
);
TreeNode
l
=
child
(
r
,
is
L
eft
);
replace
(
x
,
l
);
replace
(
x
,
l
);
b
=
l
.
balance
;
b
=
l
.
balance
;
set
(
r
,
is
left
,
child
(
l
,
!
isl
eft
));
set
(
r
,
is
Left
,
child
(
l
,
!
isL
eft
));
set
(
l
,
!
is
l
eft
,
r
);
set
(
l
,
!
is
L
eft
,
r
);
set
(
x
,
!
is
left
,
child
(
l
,
isl
eft
));
set
(
x
,
!
is
Left
,
child
(
l
,
isL
eft
));
set
(
l
,
is
l
eft
,
x
);
set
(
l
,
is
L
eft
,
x
);
x
.
balance
=
(
b
==
sign
)
?
-
sign
:
0
;
x
.
balance
=
(
b
==
sign
)
?
-
sign
:
0
;
r
.
balance
=
(
b
==
-
sign
)
?
sign
:
0
;
r
.
balance
=
(
b
==
-
sign
)
?
sign
:
0
;
l
.
balance
=
0
;
l
.
balance
=
0
;
x
=
l
;
x
=
l
;
}
}
}
}
is
l
eft
=
x
.
isFromLeft
();
is
L
eft
=
x
.
isFromLeft
();
n
=
x
.
parent
;
n
=
x
.
parent
;
}
}
}
}
...
...
h2/src/main/org/h2/index/ViewIndex.java
浏览文件 @
42715ee9
...
@@ -149,11 +149,13 @@ public class ViewIndex extends Index {
...
@@ -149,11 +149,13 @@ public class ViewIndex extends Index {
if
(
lastResult
!=
null
&&
canReuse
)
{
if
(
lastResult
!=
null
&&
canReuse
)
{
if
(
query
.
sameResultAsLast
(
session
,
params
,
lastParameters
,
lastEvaluated
))
{
if
(
query
.
sameResultAsLast
(
session
,
params
,
lastParameters
,
lastEvaluated
))
{
lastResult
=
lastResult
.
createShallowCopy
(
session
);
lastResult
=
lastResult
.
createShallowCopy
(
session
);
if
(
lastResult
!=
null
)
{
lastResult
.
reset
();
lastResult
.
reset
();
return
new
ViewCursor
(
table
,
lastResult
);
return
new
ViewCursor
(
table
,
lastResult
);
}
}
}
}
}
}
}
query
.
setSession
(
session
);
query
.
setSession
(
session
);
LocalResult
result
=
query
.
query
(
0
);
LocalResult
result
=
query
.
query
(
0
);
if
(
canReuse
)
{
if
(
canReuse
)
{
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
42715ee9
...
@@ -54,7 +54,7 @@ import java.sql.SQLClientInfoException;
...
@@ -54,7 +54,7 @@ import java.sql.SQLClientInfoException;
* Represents a connection (session) to a database.
* Represents a connection (session) to a database.
*/
*/
public
class
JdbcConnection
extends
TraceObject
implements
Connection
{
public
class
JdbcConnection
extends
TraceObject
implements
Connection
{
// TODO test: check if enough sychronization on jdbc objects
// TODO test: check if enough sy
n
chronization on jdbc objects
// TODO feature auto-reconnect on lost connection!
// TODO feature auto-reconnect on lost connection!
private
String
url
;
private
String
url
;
...
@@ -272,11 +272,11 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -272,11 +272,11 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
/**
* Switches autocommit on or off. Calling this function does not commit the
* Switches auto
commit on or off. Calling this function does not commit the
* current transaction.
* current transaction.
*
*
* @param autoCommit
* @param autoCommit
* true for autocommit on, false for off
* true for auto
commit on, false for off
* @throws SQLException
* @throws SQLException
* if the connection is closed
* if the connection is closed
*/
*/
...
@@ -299,7 +299,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -299,7 +299,7 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
/**
* Gets the current setting for autocommit.
* Gets the current setting for auto
commit.
*
*
* @return true for on, false for off
* @return true for on, false for off
* @throws SQLException
* @throws SQLException
...
@@ -319,14 +319,14 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -319,14 +319,14 @@ public class JdbcConnection extends TraceObject implements Connection {
getAutoCommit
=
prepareCommand
(
"CALL AUTOCOMMIT()"
,
getAutoCommit
);
getAutoCommit
=
prepareCommand
(
"CALL AUTOCOMMIT()"
,
getAutoCommit
);
ResultInterface
result
=
getAutoCommit
.
executeQuery
(
0
,
false
);
ResultInterface
result
=
getAutoCommit
.
executeQuery
(
0
,
false
);
result
.
next
();
result
.
next
();
boolean
auto
c
ommit
=
result
.
currentRow
()[
0
].
getBoolean
().
booleanValue
();
boolean
auto
C
ommit
=
result
.
currentRow
()[
0
].
getBoolean
().
booleanValue
();
result
.
close
();
result
.
close
();
return
auto
c
ommit
;
return
auto
C
ommit
;
}
}
/**
/**
* Commits the current transaction. This call has only an effect if
* Commits the current transaction. This call has only an effect if
* autocommit is switched off.
* auto
commit is switched off.
*
*
* @throws SQLException
* @throws SQLException
* if the connection is closed
* if the connection is closed
...
@@ -344,7 +344,7 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -344,7 +344,7 @@ public class JdbcConnection extends TraceObject implements Connection {
/**
/**
* Rolls back the current transaction. This call has only an effect if
* Rolls back the current transaction. This call has only an effect if
* autocommit is switched off.
* auto
commit is switched off.
*
*
* @throws SQLException
* @throws SQLException
* if the connection is closed
* if the connection is closed
...
@@ -1117,25 +1117,25 @@ public class JdbcConnection extends TraceObject implements Connection {
...
@@ -1117,25 +1117,25 @@ public class JdbcConnection extends TraceObject implements Connection {
i
++;
i
++;
checkRunOver
(
i
,
len
,
sql
);
checkRunOver
(
i
,
len
,
sql
);
}
}
int
re
pl
=
0
;
int
re
move
=
0
;
if
(
found
(
sql
,
start
,
"fn"
))
{
if
(
found
(
sql
,
start
,
"fn"
))
{
re
pl
=
2
;
re
move
=
2
;
}
else
if
(
found
(
sql
,
start
,
"escape"
))
{
}
else
if
(
found
(
sql
,
start
,
"escape"
))
{
break
;
break
;
}
else
if
(
found
(
sql
,
start
,
"call"
))
{
}
else
if
(
found
(
sql
,
start
,
"call"
))
{
break
;
break
;
}
else
if
(
found
(
sql
,
start
,
"oj"
))
{
}
else
if
(
found
(
sql
,
start
,
"oj"
))
{
re
pl
=
2
;
re
move
=
2
;
}
else
if
(
found
(
sql
,
start
,
"ts"
))
{
}
else
if
(
found
(
sql
,
start
,
"ts"
))
{
re
pl
=
2
;
re
move
=
2
;
}
else
if
(
found
(
sql
,
start
,
"t"
))
{
}
else
if
(
found
(
sql
,
start
,
"t"
))
{
re
pl
=
1
;
re
move
=
1
;
}
else
if
(
found
(
sql
,
start
,
"d"
))
{
}
else
if
(
found
(
sql
,
start
,
"d"
))
{
re
pl
=
1
;
re
move
=
1
;
}
else
if
(
found
(
sql
,
start
,
"params"
))
{
}
else
if
(
found
(
sql
,
start
,
"params"
))
{
re
pl
=
1
;
re
move
=
"params"
.
length
()
;
}
}
for
(
i
=
start
;
re
pl
>
0
;
i
++,
repl
--)
{
for
(
i
=
start
;
re
move
>
0
;
i
++,
remove
--)
{
chars
[
i
]
=
' '
;
chars
[
i
]
=
' '
;
}
}
break
;
break
;
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
42715ee9
...
@@ -1572,7 +1572,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -1572,7 +1572,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
}
}
/**
/**
* Returns whether refere
re
ntial integrity is supported.
* Returns whether referential integrity is supported.
*
*
* @return true
* @return true
*/
*/
...
@@ -1872,7 +1872,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -1872,7 +1872,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
}
}
/**
/**
* Returns whether open result sets ac
c
ross commits are supported.
* Returns whether open result sets across commits are supported.
*
*
* @return false
* @return false
*/
*/
...
@@ -1882,7 +1882,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -1882,7 +1882,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
}
}
/**
/**
* Returns whether open result sets ac
c
ross rollback are supported.
* Returns whether open result sets across rollback are supported.
*
*
* @return false
* @return false
*/
*/
...
@@ -1892,7 +1892,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -1892,7 +1892,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
}
}
/**
/**
* Returns whether open statements ac
c
ross commit are supported.
* Returns whether open statements across commit are supported.
*
*
* @return true
* @return true
*/
*/
...
@@ -1902,7 +1902,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -1902,7 +1902,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
}
}
/**
/**
* Returns whether open statements ac
c
ross rollback are supported.
* Returns whether open statements across rollback are supported.
*
*
* @return true
* @return true
*/
*/
...
@@ -1974,7 +1974,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -1974,7 +1974,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/**
/**
* Returns whether a specific result set type is supported.
* Returns whether a specific result set type is supported.
* ResultSet.TYPE_SCROLL_SENSITIVE is notsupported.
* ResultSet.TYPE_SCROLL_SENSITIVE is not
supported.
*
*
* @return true for all types except ResultSet.TYPE_FORWARD_ONLY
* @return true for all types except ResultSet.TYPE_FORWARD_ONLY
*/
*/
...
@@ -1985,7 +1985,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -1985,7 +1985,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/**
/**
* Returns whether a specific result set concurrency is supported.
* Returns whether a specific result set concurrency is supported.
* ResultSet.TYPE_SCROLL_SENSITIVE is notsupported.
* ResultSet.TYPE_SCROLL_SENSITIVE is not
supported.
*
*
* @return true if the type is not ResultSet.TYPE_SCROLL_SENSITIVE
* @return true if the type is not ResultSet.TYPE_SCROLL_SENSITIVE
*/
*/
...
@@ -2053,7 +2053,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -2053,7 +2053,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
}
}
/**
/**
* Returns whether updates are de
c
tected.
* Returns whether updates are detected.
* @return false
* @return false
*/
*/
public
boolean
updatesAreDetected
(
int
type
)
{
public
boolean
updatesAreDetected
(
int
type
)
{
...
@@ -2620,7 +2620,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
...
@@ -2620,7 +2620,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
}
}
/**
/**
* Returns whether an exception while autocommit is on closes all result sets.
* Returns whether an exception while auto
commit is on closes all result sets.
* @return false
* @return false
*/
*/
public
boolean
autoCommitFailureClosesAllResultSets
()
throws
SQLException
{
public
boolean
autoCommitFailureClosesAllResultSets
()
throws
SQLException
{
...
...
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
浏览文件 @
42715ee9
...
@@ -103,7 +103,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -103,7 +103,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* another result set exists for this statement, this will be closed (even if this statement fails).
* another result set exists for this statement, this will be closed (even if this statement fails).
*
*
* If the statement is a create or drop and does not throw an exception, the current transaction (if any) is
* If the statement is a create or drop and does not throw an exception, the current transaction (if any) is
* committed after executing the statement. If autocommit is on, this statement will be committed.
* committed after executing the statement. If auto
commit is on, this statement will be committed.
*
*
* @return the update count (number of row affected by an insert, update or delete, or 0 if no rows or the statement
* @return the update count (number of row affected by an insert, update or delete, or 0 if no rows or the statement
* was a create, drop, commit or rollback)
* was a create, drop, commit or rollback)
...
@@ -134,7 +134,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -134,7 +134,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
/**
/**
* Executes an arbitrary statement. If another result set exists for this statement, this will be closed (even if
* Executes an arbitrary statement. If another result set exists for this statement, this will be closed (even if
* this statement fails). If autocommit is on, and the statement is not a select, this statement will be committed.
* this statement fails). If auto
commit is on, and the statement is not a select, this statement will be committed.
*
*
* @return true if a result set is available, false if not
* @return true if a result set is available, false if not
* @throws SQLException if this object is closed or invalid
* @throws SQLException if this object is closed or invalid
...
@@ -251,7 +251,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -251,7 +251,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* Sets a parameter to null.
* Sets a parameter to null.
*
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param parameterIndex the parameter index (1, 2, ...)
* @param sqlType the data type (Types.x
xx
)
* @param sqlType the data type (Types.x)
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
public
void
setNull
(
int
parameterIndex
,
int
sqlType
)
throws
SQLException
{
public
void
setNull
(
int
parameterIndex
,
int
sqlType
)
throws
SQLException
{
...
@@ -658,7 +658,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -658,7 +658,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* Sets a parameter to null.
* Sets a parameter to null.
*
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param parameterIndex the parameter index (1, 2, ...)
* @param sqlType the data type (Types.x
xx
)
* @param sqlType the data type (Types.x)
* @param typeName this parameter is ignored
* @param typeName this parameter is ignored
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
...
@@ -998,7 +998,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -998,7 +998,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
/**
/**
* Executes the batch.
* Executes the batch.
*
*
* @return the array of updatecounts
* @return the array of update
counts
*/
*/
public
int
[]
executeBatch
()
throws
SQLException
{
public
int
[]
executeBatch
()
throws
SQLException
{
try
{
try
{
...
@@ -1037,9 +1037,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -1037,9 +1037,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
}
}
batchParameters
=
null
;
batchParameters
=
null
;
if
(
error
)
{
if
(
error
)
{
JdbcBatchUpdateException
bu
e
=
new
JdbcBatchUpdateException
(
next
,
result
);
JdbcBatchUpdateException
e
=
new
JdbcBatchUpdateException
(
next
,
result
);
bu
e
.
setNextException
(
next
);
e
.
setNextException
(
next
);
throw
bu
e
;
throw
e
;
}
}
return
result
;
return
result
;
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
42715ee9
...
@@ -59,7 +59,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -59,7 +59,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
/**
* Moves the cursor to the next row of the result set.
* Moves the cursor to the next row of the result set.
*
*
* @return true if successful
l
, false if there are no more rows
* @return true if successful, false if there are no more rows
*/
*/
public
boolean
next
()
throws
SQLException
{
public
boolean
next
()
throws
SQLException
{
try
{
try
{
...
@@ -393,7 +393,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -393,7 +393,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns a column value as a Java object. For BINARY data, the data is deserialized into a Java Object.
* Returns a column value as a Java object. For BINARY data, the data is de
-
serialized into a Java Object.
*
*
* @param columnIndex (1,2,...)
* @param columnIndex (1,2,...)
* @return the value or null
* @return the value or null
...
@@ -415,7 +415,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -415,7 +415,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns a column value as a Java object. For BINARY data, the data is deserialized into a Java Object.
* Returns a column value as a Java object. For BINARY data, the data is de
-
serialized into a Java Object.
*
*
* @param columnName the name of the column label
* @param columnName the name of the column label
* @return the value or null
* @return the value or null
...
@@ -2253,7 +2253,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2253,7 +2253,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
/**
* [Not supported] Gets the cursor name if it was defined. This feature is superseded by
* [Not supported] Gets the cursor name if it was defined. This feature is superseded by
* updateX
XX
methods. This method throws a SQLException because cursor names are not supported.
* updateX methods. This method throws a SQLException because cursor names are not supported.
*/
*/
public
String
getCursorName
()
throws
SQLException
{
public
String
getCursorName
()
throws
SQLException
{
try
{
try
{
...
@@ -2294,8 +2294,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2294,8 +2294,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
try
{
try
{
debugCodeCall
(
"getConcurrency"
);
debugCodeCall
(
"getConcurrency"
);
checkClosed
();
checkClosed
();
UpdatableRow
upd
=
new
UpdatableRow
(
conn
,
result
,
session
);
UpdatableRow
row
=
new
UpdatableRow
(
conn
,
result
,
session
);
return
upd
.
isUpdatable
()
?
ResultSet
.
CONCUR_UPDATABLE
:
ResultSet
.
CONCUR_READ_ONLY
;
return
row
.
isUpdatable
()
?
ResultSet
.
CONCUR_UPDATABLE
:
ResultSet
.
CONCUR_READ_ONLY
;
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
@@ -2783,11 +2783,11 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2783,11 +2783,11 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
private
UpdatableRow
getUpdatableRow
()
throws
SQLException
{
private
UpdatableRow
getUpdatableRow
()
throws
SQLException
{
UpdatableRow
upd
=
new
UpdatableRow
(
conn
,
result
,
session
);
UpdatableRow
row
=
new
UpdatableRow
(
conn
,
result
,
session
);
if
(!
upd
.
isUpdatable
())
{
if
(!
row
.
isUpdatable
())
{
throw
Message
.
getSQLException
(
Message
.
NOT_ON_UPDATABLE_ROW
);
throw
Message
.
getSQLException
(
Message
.
NOT_ON_UPDATABLE_ROW
);
}
}
return
upd
;
return
row
;
}
}
int
getColumnIndex
(
String
columnName
)
throws
SQLException
{
int
getColumnIndex
(
String
columnName
)
throws
SQLException
{
...
...
h2/src/main/org/h2/jdbc/JdbcStatement.java
浏览文件 @
42715ee9
...
@@ -85,7 +85,7 @@ public class JdbcStatement extends TraceObject implements Statement {
...
@@ -85,7 +85,7 @@ public class JdbcStatement extends TraceObject implements Statement {
*
*
* If the statement is a create or drop and does not throw an exception,
* If the statement is a create or drop and does not throw an exception,
* the current transaction (if any) is committed after executing the statement.
* the current transaction (if any) is committed after executing the statement.
* If autocommit is on, this statement will be committed.
* If auto
commit is on, this statement will be committed.
*
*
* @param sql the SQL statement
* @param sql the SQL statement
* @return the update count (number of row affected by an insert,
* @return the update count (number of row affected by an insert,
...
@@ -125,7 +125,7 @@ public class JdbcStatement extends TraceObject implements Statement {
...
@@ -125,7 +125,7 @@ public class JdbcStatement extends TraceObject implements Statement {
*
*
* If the statement is a create or drop and does not throw an exception,
* If the statement is a create or drop and does not throw an exception,
* the current transaction (if any) is committed after executing the statement.
* the current transaction (if any) is committed after executing the statement.
* If autocommit is on, and the statement is not a select, this statement will be committed.
* If auto
commit is on, and the statement is not a select, this statement will be committed.
*
*
* @return true if a result set is available, false if not
* @return true if a result set is available, false if not
*/
*/
...
@@ -585,7 +585,7 @@ public class JdbcStatement extends TraceObject implements Statement {
...
@@ -585,7 +585,7 @@ public class JdbcStatement extends TraceObject implements Statement {
/**
/**
* Executes the batch.
* Executes the batch.
*
*
* @return the array of updatecounts
* @return the array of update
counts
*/
*/
public
int
[]
executeBatch
()
throws
SQLException
{
public
int
[]
executeBatch
()
throws
SQLException
{
try
{
try
{
...
...
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
42715ee9
...
@@ -71,14 +71,17 @@ implements XAConnection, XAResource, JdbcConnectionListener
...
@@ -71,14 +71,17 @@ implements XAConnection, XAResource, JdbcConnectionListener
info
.
setProperty
(
"user"
,
user
);
info
.
setProperty
(
"user"
,
user
);
info
.
setProperty
(
"password"
,
password
);
info
.
setProperty
(
"password"
,
password
);
conn
=
new
JdbcConnection
(
url
,
info
);
conn
=
new
JdbcConnection
(
url
,
info
);
conn
.
setJdbcConnectionListener
(
this
);
return
conn
;
return
conn
;
}
}
public
void
addConnectionEventListener
(
ConnectionEventListener
listener
)
{
public
void
addConnectionEventListener
(
ConnectionEventListener
listener
)
{
debugCode
(
"addConnectionEventListener(listener)"
);
debugCode
(
"addConnectionEventListener(listener)"
);
listeners
.
add
(
listener
);
listeners
.
add
(
listener
);
if
(
conn
!=
null
)
{
conn
.
setJdbcConnectionListener
(
this
);
conn
.
setJdbcConnectionListener
(
this
);
}
}
}
public
void
removeConnectionEventListener
(
ConnectionEventListener
listener
)
{
public
void
removeConnectionEventListener
(
ConnectionEventListener
listener
)
{
debugCode
(
"removeConnectionEventListener(listener)"
);
debugCode
(
"removeConnectionEventListener(listener)"
);
...
@@ -238,7 +241,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
...
@@ -238,7 +241,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
buff
.
append
(
xid
.
getFormatId
());
buff
.
append
(
xid
.
getFormatId
());
buff
.
append
(
",bq:"
);
buff
.
append
(
",bq:"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
xid
.
getBranchQualifier
()));
buff
.
append
(
ByteUtils
.
convertBytesToString
(
xid
.
getBranchQualifier
()));
buff
.
append
(
",gx
id
:"
);
buff
.
append
(
",gx:"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
xid
.
getGlobalTransactionId
()));
buff
.
append
(
ByteUtils
.
convertBytesToString
(
xid
.
getGlobalTransactionId
()));
buff
.
append
(
",c:"
);
buff
.
append
(
",c:"
);
buff
.
append
(
xid
.
getClass
().
getName
());
buff
.
append
(
xid
.
getClass
().
getName
());
...
...
h2/src/main/org/h2/message/Message.java
浏览文件 @
42715ee9
...
@@ -23,7 +23,7 @@ public class Message {
...
@@ -23,7 +23,7 @@ public class Message {
private
static
final
Properties
MESSAGES
=
new
Properties
();
private
static
final
Properties
MESSAGES
=
new
Properties
();
static
{
static
{
// TODO multilanguage messages
// TODO multi
language messages
// String language = Locale.getDefault().getLanguage();
// String language = Locale.getDefault().getLanguage();
try
{
try
{
byte
[]
messages
=
Resources
.
get
(
"/org/h2/res/messages.properties"
);
byte
[]
messages
=
Resources
.
get
(
"/org/h2/res/messages.properties"
);
...
@@ -37,16 +37,14 @@ public class Message {
...
@@ -37,16 +37,14 @@ public class Message {
/**
/**
* Gets the SQL Exception object for a specific SQLState. Supported
* Gets the SQL Exception object for a specific SQLState. Supported
*
sql
states are:
*
SQL
states are:
*
*
* @param sqlstate -
* @param sqlState - the SQL State
* the SQL State
* @param param - the parameter of the message
* @param param -
* the parameter of the message
* @return the SQLException object
* @return the SQLException object
*/
*/
public
static
JdbcSQLException
getSQLException
(
int
sql
s
tate
,
String
p1
)
{
public
static
JdbcSQLException
getSQLException
(
int
sql
S
tate
,
String
p1
)
{
return
getSQLException
(
sql
s
tate
,
new
String
[]
{
p1
},
null
);
return
getSQLException
(
sql
S
tate
,
new
String
[]
{
p1
},
null
);
}
}
public
static
String
translate
(
String
key
,
String
[]
param
)
{
public
static
String
translate
(
String
key
,
String
[]
param
)
{
...
@@ -360,8 +358,8 @@ public class Message {
...
@@ -360,8 +358,8 @@ public class Message {
if
(
e
instanceof
SQLException
)
{
if
(
e
instanceof
SQLException
)
{
return
(
SQLException
)
e
;
return
(
SQLException
)
e
;
}
else
if
(
e
instanceof
InvocationTargetException
)
{
}
else
if
(
e
instanceof
InvocationTargetException
)
{
InvocationTargetException
i
te
=
(
InvocationTargetException
)
e
;
InvocationTargetException
te
=
(
InvocationTargetException
)
e
;
Throwable
t
=
i
te
.
getTargetException
();
Throwable
t
=
te
.
getTargetException
();
if
(
t
instanceof
SQLException
)
{
if
(
t
instanceof
SQLException
)
{
return
(
SQLException
)
t
;
return
(
SQLException
)
t
;
}
}
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
42715ee9
...
@@ -67,8 +67,8 @@ MERGE INTO tableName [(columnName [,...])] [KEY(columnName [,...])]
...
@@ -67,8 +67,8 @@ MERGE INTO tableName [(columnName [,...])] [KEY(columnName [,...])]
","
","
Updates the row if it exists, and if the row does not exist, inserts a new row.
Updates the row if it exists, and if the row does not exist, inserts a new row.
If the key columns are not specified, the primary key columns are used to find the row.
If the key columns are not specified, the primary key columns are used to find the row.
This command is sometimes called 'UPSERT' as it
UP
dates a row if it exists,
This command is sometimes called 'UPSERT' as it
up
dates a row if it exists,
or in
SERTS
the row if it does not yet exist.
or in
serts
the row if it does not yet exist.
If more than one row per new row is affected, an exception is thrown.
If more than one row per new row is affected, an exception is thrown.
","
","
MERGE INTO TEST KEY(ID) VALUES(2, 'World')
MERGE INTO TEST KEY(ID) VALUES(2, 'World')
...
@@ -122,7 +122,7 @@ ALTER SEQUENCE sequenceName
...
@@ -122,7 +122,7 @@ ALTER SEQUENCE sequenceName
","
","
Changes the next value and / or the increment of a sequence.
Changes the next value and / or the increment of a sequence.
","
","
ALTER SEQUENCE SEQID RESTART WITH 1000
ALTER SEQUENCE SEQ
_
ID RESTART WITH 1000
"
"
"Commands (DDL)","ALTER TABLE ADD","
"Commands (DDL)","ALTER TABLE ADD","
...
@@ -197,8 +197,8 @@ ALTER TABLE TEST ALTER COLUMN NAME SET DEFAULT ''
...
@@ -197,8 +197,8 @@ ALTER TABLE TEST ALTER COLUMN NAME SET DEFAULT ''
ALTER TABLE tableName ALTER COLUMN columnName
ALTER TABLE tableName ALTER COLUMN columnName
SET NOT NULL
SET NOT NULL
","
","
Sets a column to not allow NULL
values
.
Sets a column to not allow NULL.
This is not possible if there are any
null values in the table
.
This is not possible if there are any
rows with NULL in this column
.
","
","
ALTER TABLE TEST ALTER COLUMN NAME SET NOT NULL
ALTER TABLE TEST ALTER COLUMN NAME SET NOT NULL
"
"
...
@@ -207,7 +207,7 @@ ALTER TABLE TEST ALTER COLUMN NAME SET NOT NULL
...
@@ -207,7 +207,7 @@ ALTER TABLE TEST ALTER COLUMN NAME SET NOT NULL
ALTER TABLE tableName ALTER COLUMN columnName
ALTER TABLE tableName ALTER COLUMN columnName
SET NULL
SET NULL
","
","
Sets a column to allow NULL
values
.
Sets a column to allow NULL.
This is not possible if the column is part of a primary key or multi-column hash index.
This is not possible if the column is part of a primary key or multi-column hash index.
If there are single column indexes on this column, they are dropped.
If there are single column indexes on this column, they are dropped.
","
","
...
@@ -235,7 +235,7 @@ ALTER TABLE tableName RENAME TO newName
...
@@ -235,7 +235,7 @@ ALTER TABLE tableName RENAME TO newName
","
","
Renames a table.
Renames a table.
","
","
ALTER TABLE TEST RENAME TO MYDATA
ALTER TABLE TEST RENAME TO MY
_
DATA
"
"
"Commands (DDL)","ALTER USER ADMIN","
"Commands (DDL)","ALTER USER ADMIN","
...
@@ -331,7 +331,7 @@ CREATE DOMAIN [IF NOT EXISTS] newDomainName AS dataType
...
@@ -331,7 +331,7 @@ CREATE DOMAIN [IF NOT EXISTS] newDomainName AS dataType
[CHECK condition]
[CHECK condition]
","
","
Creates a new data type (domain).
Creates a new data type (domain).
The check condition must evaluate to true or to NULL (to prevent NULL
values
, use NOT NULL).
The check condition must evaluate to true or to NULL (to prevent NULL, use NOT NULL).
In the condition, the term VALUE refers to the value being tested.
In the condition, the term VALUE refers to the value being tested.
","
","
CREATE DOMAIN EMAIL AS VARCHAR(255) CHECK (POSITION('@', VALUE) > 1)
CREATE DOMAIN EMAIL AS VARCHAR(255) CHECK (POSITION('@', VALUE) > 1)
...
@@ -383,7 +383,7 @@ CREATE SEQUENCE [IF NOT EXISTS] newSequenceName
...
@@ -383,7 +383,7 @@ CREATE SEQUENCE [IF NOT EXISTS] newSequenceName
","
","
Creates a new sequence. The data type of a sequence is BIGINT.
Creates a new sequence. The data type of a sequence is BIGINT.
","
","
CREATE SEQUENCE SEQID
CREATE SEQUENCE SEQ
_
ID
"
"
"Commands (DDL)","CREATE TABLE","
"Commands (DDL)","CREATE TABLE","
...
@@ -486,7 +486,7 @@ DROP SEQUENCE [IF EXISTS] sequenceName
...
@@ -486,7 +486,7 @@ DROP SEQUENCE [IF EXISTS] sequenceName
","
","
Drops a sequence.
Drops a sequence.
","
","
DROP SEQUENCE SEQID
DROP SEQUENCE SEQ
_
ID
"
"
"Commands (DDL)","DROP SCHEMA","
"Commands (DDL)","DROP SCHEMA","
DROP SCHEMA [IF EXISTS] schemaName
DROP SCHEMA [IF EXISTS] schemaName
...
@@ -679,7 +679,7 @@ SET ASSERT 0
...
@@ -679,7 +679,7 @@ SET ASSERT 0
"Commands (Other)","SET AUTOCOMMIT","
"Commands (Other)","SET AUTOCOMMIT","
SET AUTOCOMMIT {TRUE | ON | FALSE | OFF}
SET AUTOCOMMIT {TRUE | ON | FALSE | OFF}
","
","
Switches autocommit on or off.
Switches auto
commit on or off.
","
","
SET AUTOCOMMIT OFF
SET AUTOCOMMIT OFF
"
"
...
@@ -726,7 +726,7 @@ SET COLLATION ENGLISH
...
@@ -726,7 +726,7 @@ SET COLLATION ENGLISH
"Commands (Other)","SET COMPRESS_LOB","
"Commands (Other)","SET COMPRESS_LOB","
SET COMPRESS_LOB {NO|LZF|DEFLATE}
SET COMPRESS_LOB {NO|LZF|DEFLATE}
","
","
Sets the compression algorithm for BLOB
s and CLOBs
.
Sets the compression algorithm for BLOB
and CLOB data
.
Compression is usually slower, but needs less memory.
Compression is usually slower, but needs less memory.
This setting is persistent.
This setting is persistent.
Admin rights are required to execute this command.
Admin rights are required to execute this command.
...
@@ -930,7 +930,7 @@ SET PASSWORD string
...
@@ -930,7 +930,7 @@ SET PASSWORD string
Changes the password of the current user.
Changes the password of the current user.
The password must be in single quotes. It is case sensitive and can contain spaces.
The password must be in single quotes. It is case sensitive and can contain spaces.
","
","
SET PASSWORD 'stzri!.5'
SET PASSWORD '
abc
stzri!.5'
"
"
"Commands (Other)","SET SALT HASH","
"Commands (Other)","SET SALT HASH","
...
@@ -1041,7 +1041,7 @@ CHECK expression
...
@@ -1041,7 +1041,7 @@ CHECK expression
| referentialConstraint}
| referentialConstraint}
","
","
Defines a constraint.
Defines a constraint.
The check condition must evaluate to true or to NULL (to prevent NULL
values
, use NOT NULL).
The check condition must evaluate to true or to NULL (to prevent NULL, use NOT NULL).
","
","
PRIMARY KEY(ID, NAME)
PRIMARY KEY(ID, NAME)
"
"
...
@@ -2325,7 +2325,7 @@ YEAR(CREATED)
...
@@ -2325,7 +2325,7 @@ YEAR(CREATED)
"Functions (System)","AUTOCOMMIT","
"Functions (System)","AUTOCOMMIT","
AUTOCOMMIT(): boolean
AUTOCOMMIT(): boolean
","
","
Returns true if autocommit is switched on for this session.
Returns true if auto
commit is switched on for this session.
","
","
AUTOCOMMIT()
AUTOCOMMIT()
"
"
...
@@ -2368,7 +2368,7 @@ Returns the current (last) value of the sequence.
...
@@ -2368,7 +2368,7 @@ Returns the current (last) value of the sequence.
If the schema name is not set, the current schema is used.
If the schema name is not set, the current schema is used.
If the schema name is not set, the sequence name is converted to uppercase (for compatibility).
If the schema name is not set, the sequence name is converted to uppercase (for compatibility).
","
","
CURRVAL('TESTSEQ')
CURRVAL('TEST
_
SEQ')
"
"
"Functions (System)","CSVREAD","
"Functions (System)","CSVREAD","
...
@@ -2471,7 +2471,7 @@ Returns the next value of the sequence.
...
@@ -2471,7 +2471,7 @@ Returns the next value of the sequence.
If the schema name is not set, the current schema is used.
If the schema name is not set, the current schema is used.
If the schema name is not set, the sequence name is converted to uppercase (for compatibility).
If the schema name is not set, the sequence name is converted to uppercase (for compatibility).
","
","
NEXTVAL('TESTSEQ')
NEXTVAL('TEST
_
SEQ')
"
"
"Functions (System)","NULLIF","
"Functions (System)","NULLIF","
...
...
h2/src/main/org/h2/res/messages.properties
浏览文件 @
42715ee9
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
90003
=
Hexadecimal string with odd number of characters: {0}
90003
=
Hexadecimal string with odd number of characters: {0}
90004
=
Hexadecimal string contains non hex character: {0}
90004
=
Hexadecimal string contains non hex character: {0}
90005
=
Value too long for column {0}
90005
=
Value too long for column {0}
90006
=
Null
value
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}
...
@@ -116,7 +116,7 @@
...
@@ -116,7 +116,7 @@
90093
=
Clustering error - database currently runs in standalone mode
90093
=
Clustering error - database currently runs in standalone mode
90094
=
Clustering error - database currently runs in cluster mode, server list: {0}
90094
=
Clustering error - database currently runs in cluster mode, server list: {0}
90095
=
String format error: {0}
90095
=
String format error: {0}
90096
=
Not enough
t
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}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论