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 {
if
(
value
==
null
)
{
value
=
v
;
}
else
{
v
=
v
.
convertTo
(
value
.
getType
());
value
=
value
.
add
(
v
);
}
break
;
...
...
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
42715ee9
...
...
@@ -78,6 +78,7 @@ public class Comparison extends Condition {
Function
function
=
Function
.
getFunction
(
session
.
getDatabase
(),
"CAST"
);
function
.
setParameter
(
0
,
expr
);
function
.
setDataType
(
dataType
,
precision
,
scale
);
function
.
doneWithParameters
();
return
function
.
optimize
(
session
);
}
...
...
h2/src/main/org/h2/expression/ConditionAndOr.java
浏览文件 @
42715ee9
...
...
@@ -97,7 +97,7 @@ public class ConditionAndOr extends Condition {
}
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 document NULL exactly for every case
left
=
left
.
optimize
(
session
);
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
42715ee9
...
...
@@ -91,13 +91,13 @@ public class Function extends Expression implements FunctionCall {
ARRAY_GET
=
209
,
CSVREAD
=
210
,
CSVWRITE
=
211
,
MEMORY_FREE
=
212
,
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
FunctionInfo
info
;
private
Expression
[]
args
;
private
ObjectArray
var
a
rgs
;
private
ObjectArray
var
A
rgs
;
private
int
dataType
,
scale
;
private
long
precision
;
private
Database
database
;
...
...
@@ -163,7 +163,7 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"PI"
,
PI
,
0
,
Value
.
DOUBLE
);
addFunction
(
"POWER"
,
POWER
,
2
,
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
(
"ROUNDMAGIC"
,
ROUNDMAGIC
,
1
,
Value
.
DOUBLE
);
addFunction
(
"SIGN"
,
SIGN
,
1
,
Value
.
INT
);
...
...
@@ -175,7 +175,7 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"ENCRYPT"
,
ENCRYPT
,
3
,
Value
.
BYTES
);
addFunction
(
"DECRYPT"
,
DECRYPT
,
3
,
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
(
"ZERO"
,
ZERO
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"RANDOM_UUID"
,
RANDOM_UUID
,
0
,
Value
.
UUID
);
...
...
@@ -186,38 +186,38 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"CHAR"
,
CHAR
,
1
,
Value
.
STRING
);
addFunction
(
"CHAR_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
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
(
"HEXTORAW"
,
HEXTORAW
,
1
,
Value
.
STRING
);
addFunctionWithNull
(
"INSERT"
,
INSERT
,
4
,
Value
.
STRING
);
addFunction
(
"LCASE"
,
LCASE
,
1
,
Value
.
STRING
);
addFunction
(
"LEFT"
,
LEFT
,
2
,
Value
.
STRING
);
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
(
"INSTR"
,
INSTR
,
VARARGS
,
Value
.
INT
);
addFunction
(
"LTRIM"
,
LTRIM
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"INSTR"
,
INSTR
,
VAR
_
ARGS
,
Value
.
INT
);
addFunction
(
"LTRIM"
,
LTRIM
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"OCTET_LENGTH"
,
OCTET_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"RAWTOHEX"
,
RAWTOHEX
,
1
,
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
(
"RTRIM"
,
RTRIM
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"RTRIM"
,
RTRIM
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"SOUNDEX"
,
SOUNDEX
,
1
,
Value
.
STRING
);
addFunction
(
"SPACE"
,
SPACE
,
1
,
Value
.
STRING
);
addFunction
(
"SUBSTR"
,
SUBSTR
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"SUBSTRING"
,
SUBSTRING
,
VARARGS
,
Value
.
STRING
);
addFunction
(
"SUBSTR"
,
SUBSTR
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"SUBSTRING"
,
SUBSTRING
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunction
(
"UCASE"
,
UCASE
,
1
,
Value
.
STRING
);
addFunction
(
"LOWER"
,
LOWER
,
1
,
Value
.
STRING
);
addFunction
(
"UPPER"
,
UPPER
,
1
,
Value
.
STRING
);
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
(
"STRINGDECODE"
,
STRINGDECODE
,
1
,
Value
.
STRING
);
addFunction
(
"STRINGTOUTF8"
,
STRINGTOUTF8
,
1
,
Value
.
BYTES
);
addFunction
(
"UTF8TOSTRING"
,
UTF8TOSTRING
,
1
,
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
(
"XMLCDATA"
,
XMLCDATA
,
1
,
Value
.
STRING
);
addFunction
(
"XMLSTARTDOC"
,
XMLSTARTDOC
,
0
,
Value
.
STRING
);
...
...
@@ -228,8 +228,8 @@ public class Function extends Expression implements FunctionCall {
addFunctionNotConst
(
"CURDATE"
,
CURDATE
,
0
,
Value
.
DATE
);
addFunctionNotConst
(
"CURRENT_TIME"
,
CURRENT_TIME
,
0
,
Value
.
TIME
);
addFunctionNotConst
(
"CURTIME"
,
CURTIME
,
0
,
Value
.
TIME
);
addFunctionNotConst
(
"CURRENT_TIMESTAMP"
,
CURRENT_TIMESTAMP
,
VARARGS
,
Value
.
TIMESTAMP
);
addFunctionNotConst
(
"NOW"
,
NOW
,
VARARGS
,
Value
.
TIMESTAMP
);
addFunctionNotConst
(
"CURRENT_TIMESTAMP"
,
CURRENT_TIMESTAMP
,
VAR
_
ARGS
,
Value
.
TIMESTAMP
);
addFunctionNotConst
(
"NOW"
,
NOW
,
VAR
_
ARGS
,
Value
.
TIMESTAMP
);
addFunction
(
"DATEADD"
,
DATEADD
,
3
,
Value
.
TIMESTAMP
);
addFunction
(
"DATEDIFF"
,
DATEDIFF
,
3
,
Value
.
LONG
);
addFunction
(
"DAYNAME"
,
DAYNAME
,
1
,
Value
.
STRING
);
...
...
@@ -246,8 +246,8 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"WEEK"
,
WEEK
,
1
,
Value
.
INT
);
addFunction
(
"YEAR"
,
YEAR
,
1
,
Value
.
INT
);
addFunction
(
"EXTRACT"
,
EXTRACT
,
2
,
Value
.
INT
);
addFunctionWithNull
(
"FORMATDATETIME"
,
FORMATDATETIME
,
VARARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"PARSEDATETIME"
,
PARSEDATETIME
,
VARARGS
,
Value
.
TIMESTAMP
);
addFunctionWithNull
(
"FORMATDATETIME"
,
FORMATDATETIME
,
VAR
_
ARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"PARSEDATETIME"
,
PARSEDATETIME
,
VAR
_
ARGS
,
Value
.
TIMESTAMP
);
// system
addFunctionNotConst
(
"DATABASE"
,
DATABASE
,
0
,
Value
.
STRING
);
addFunctionNotConst
(
"USER"
,
USER
,
0
,
Value
.
STRING
);
...
...
@@ -263,15 +263,15 @@ public class Function extends Expression implements FunctionCall {
addFunctionWithNull
(
"CASEWHEN"
,
CASEWHEN
,
3
,
Value
.
NULL
);
addFunctionWithNull
(
"CONVERT"
,
CONVERT
,
1
,
Value
.
NULL
);
addFunctionWithNull
(
"CAST"
,
CAST
,
1
,
Value
.
NULL
);
addFunctionWithNull
(
"COALESCE"
,
COALESCE
,
VARARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"NVL"
,
COALESCE
,
VARARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"COALESCE"
,
COALESCE
,
VAR
_
ARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"NVL"
,
COALESCE
,
VAR
_
ARGS
,
Value
.
NULL
);
addFunctionWithNull
(
"NULLIF"
,
NULLIF
,
2
,
Value
.
NULL
);
addFunctionWithNull
(
"CASE"
,
CASE
,
VARARGS
,
Value
.
NULL
);
addFunctionNotConst
(
"NEXTVAL"
,
NEXTVAL
,
VARARGS
,
Value
.
LONG
);
addFunctionNotConst
(
"CURRVAL"
,
CURRVAL
,
VARARGS
,
Value
.
LONG
);
addFunctionWithNull
(
"CASE"
,
CASE
,
VAR
_
ARGS
,
Value
.
NULL
);
addFunctionNotConst
(
"NEXTVAL"
,
NEXTVAL
,
VAR
_
ARGS
,
Value
.
LONG
);
addFunctionNotConst
(
"CURRVAL"
,
CURRVAL
,
VAR
_
ARGS
,
Value
.
LONG
);
addFunction
(
"ARRAY_GET"
,
ARRAY_GET
,
2
,
Value
.
NULL
);
addFunction
(
"CSVREAD"
,
CSVREAD
,
VARARGS
,
Value
.
RESULT_SET
,
false
,
false
);
addFunction
(
"CSVWRITE"
,
CSVWRITE
,
VARARGS
,
Value
.
NULL
,
false
,
false
);
addFunction
(
"CSVREAD"
,
CSVREAD
,
VAR
_
ARGS
,
Value
.
RESULT_SET
,
false
,
false
);
addFunction
(
"CSVWRITE"
,
CSVWRITE
,
VAR
_
ARGS
,
Value
.
NULL
,
false
,
false
);
addFunctionNotConst
(
"MEMORY_FREE"
,
MEMORY_FREE
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"MEMORY_USED"
,
MEMORY_USED
,
0
,
Value
.
INT
);
addFunctionNotConst
(
"LOCK_MODE"
,
LOCK_MODE
,
0
,
Value
.
INT
);
...
...
@@ -318,16 +318,16 @@ public class Function extends Expression implements FunctionCall {
private
Function
(
Database
database
,
FunctionInfo
info
)
{
this
.
database
=
database
;
this
.
info
=
info
;
if
(
info
.
parameterCount
==
VARARGS
)
{
var
a
rgs
=
new
ObjectArray
();
if
(
info
.
parameterCount
==
VAR
_
ARGS
)
{
var
A
rgs
=
new
ObjectArray
();
}
else
{
args
=
new
Expression
[
info
.
parameterCount
];
}
}
public
void
setParameter
(
int
index
,
Expression
param
)
throws
SQLException
{
if
(
var
a
rgs
!=
null
)
{
var
a
rgs
.
add
(
param
);
if
(
var
A
rgs
!=
null
)
{
var
A
rgs
.
add
(
param
);
}
else
{
if
(
index
>=
args
.
length
)
{
throw
Message
.
getSQLException
(
Message
.
INVALID_PARAMETER_COUNT_1
,
""
+
args
.
length
);
...
...
@@ -914,7 +914,7 @@ public class Function extends Expression implements FunctionCall {
int
field
=
getDatePart
(
part
);
Calendar
calendar
=
Calendar
.
getInstance
();
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
();
calendar
.
setTime
(
d1
);
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 {
s
=
(
i
==
0
)
?
s
:
s
.
substring
(
i
);
}
if
(
trailing
)
{
int
end
i
ndex
=
s
.
length
()
-
1
;
int
i
=
end
i
ndex
;
int
end
I
ndex
=
s
.
length
()
-
1
;
int
i
=
end
I
ndex
;
while
(
i
>=
0
&&
s
.
charAt
(
i
)
==
space
)
{
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
;
}
...
...
@@ -1149,21 +1149,21 @@ public class Function extends Expression implements FunctionCall {
private
static
String
getSoundex
(
String
s
)
{
int
len
=
s
.
length
();
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
++)
{
char
c
=
s
.
charAt
(
i
);
char
new
d
igit
=
c
>
SOUNDEX_INDEX
.
length
?
0
:
SOUNDEX_INDEX
[
c
];
if
(
new
d
igit
!=
0
)
{
char
new
D
igit
=
c
>
SOUNDEX_INDEX
.
length
?
0
:
SOUNDEX_INDEX
[
c
];
if
(
new
D
igit
!=
0
)
{
if
(
j
==
0
)
{
chars
[
j
++]
=
c
;
last
digit
=
newd
igit
;
}
else
if
(
new
d
igit
<=
'6'
)
{
if
(
new
digit
!=
lastd
igit
)
{
chars
[
j
++]
=
new
d
igit
;
last
digit
=
newd
igit
;
last
Digit
=
newD
igit
;
}
else
if
(
new
D
igit
<=
'6'
)
{
if
(
new
Digit
!=
lastD
igit
)
{
chars
[
j
++]
=
new
D
igit
;
last
Digit
=
newD
igit
;
}
}
else
if
(
new
d
igit
==
'7'
)
{
last
digit
=
newd
igit
;
}
else
if
(
new
D
igit
==
'7'
)
{
last
Digit
=
newD
igit
;
}
}
}
...
...
@@ -1181,8 +1181,8 @@ public class Function extends Expression implements FunctionCall {
}
public
void
doneWithParameters
()
throws
SQLException
{
if
(
info
.
parameterCount
==
VARARGS
)
{
int
len
=
var
a
rgs
.
size
();
if
(
info
.
parameterCount
==
VAR
_
ARGS
)
{
int
len
=
var
A
rgs
.
size
();
int
min
=
0
,
max
=
Integer
.
MAX_VALUE
;
switch
(
info
.
type
)
{
case
COALESCE:
...
...
@@ -1239,8 +1239,8 @@ public class Function extends Expression implements FunctionCall {
throw
Message
.
getSQLException
(
Message
.
INVALID_PARAMETER_COUNT_1
,
min
+
".."
+
max
);
}
args
=
new
Expression
[
len
];
var
a
rgs
.
toArray
(
args
);
var
a
rgs
=
null
;
var
A
rgs
.
toArray
(
args
);
var
A
rgs
=
null
;
}
else
{
int
len
=
args
.
length
;
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 {
String
first
=
null
;
String
last
=
null
;
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
)
{
first
=
first
n
ow
;
first
=
first
N
ow
;
}
if
(
last
!=
null
&&
!
last
.
equals
(
first
n
ow
))
{
System
.
out
.
println
(
"STOP!!! "
+
last
+
" first
now:"
+
firstn
ow
);
if
(
last
!=
null
&&
!
last
.
equals
(
first
N
ow
))
{
System
.
out
.
println
(
"STOP!!! "
+
last
+
" first
Now:"
+
firstN
ow
);
}
if
(
i
<
pageData
.
size
())
{
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 {
public
int
getRealByteCount
(
DataPage
dummy
)
throws
SQLException
{
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
++)
{
LinearHashEntry
record
=
(
LinearHashEntry
)
records
.
get
(
i
);
// 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
();
}
if
(
size
+
data
s
ize
>=
index
.
getBucketSize
())
{
if
(
size
+
data
S
ize
>=
index
.
getBucketSize
())
{
writePos
=
true
;
return
size
;
}
else
{
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 {
// (and it would be an error to set next to -1)
moveOut
(
session
,
foreign
,
storeIn
);
if
(
Constants
.
CHECK
&&
getBucket
(
foreign
).
getNextBucket
()
!=
-
1
)
{
throw
Message
.
getInternalError
(
"move
o
ut "
+
foreign
);
throw
Message
.
getInternalError
(
"move
O
ut "
+
foreign
);
}
return
;
}
...
...
h2/src/main/org/h2/index/TreeIndex.java
浏览文件 @
42715ee9
...
...
@@ -34,7 +34,7 @@ public class TreeIndex extends Index {
public
void
add
(
Session
session
,
Row
row
)
throws
SQLException
{
TreeNode
i
=
new
TreeNode
(
row
);
TreeNode
n
=
root
,
x
=
n
;
boolean
is
l
eft
=
true
;
boolean
is
L
eft
=
true
;
while
(
true
)
{
if
(
n
==
null
)
{
if
(
x
==
null
)
{
...
...
@@ -42,7 +42,7 @@ public class TreeIndex extends Index {
rowCount
++;
return
;
}
set
(
x
,
is
l
eft
,
i
);
set
(
x
,
is
L
eft
,
i
);
break
;
}
Row
r
=
n
.
row
;
...
...
@@ -55,17 +55,17 @@ public class TreeIndex extends Index {
}
compare
=
compareKeys
(
row
,
r
);
}
is
l
eft
=
compare
<
0
;
is
L
eft
=
compare
<
0
;
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
++;
}
private
void
balance
(
TreeNode
x
,
boolean
is
l
eft
)
{
private
void
balance
(
TreeNode
x
,
boolean
is
L
eft
)
{
while
(
true
)
{
int
sign
=
is
l
eft
?
1
:
-
1
;
int
sign
=
is
L
eft
?
1
:
-
1
;
switch
(
x
.
balance
*
sign
)
{
case
1
:
x
.
balance
=
0
;
...
...
@@ -74,20 +74,20 @@ public class TreeIndex extends Index {
x
.
balance
=
-
sign
;
break
;
case
-
1
:
TreeNode
l
=
child
(
x
,
is
l
eft
);
TreeNode
l
=
child
(
x
,
is
L
eft
);
if
(
l
.
balance
==
-
sign
)
{
replace
(
x
,
l
);
set
(
x
,
is
left
,
child
(
l
,
!
isl
eft
));
set
(
l
,
!
is
l
eft
,
x
);
set
(
x
,
is
Left
,
child
(
l
,
!
isL
eft
));
set
(
l
,
!
is
L
eft
,
x
);
x
.
balance
=
0
;
l
.
balance
=
0
;
}
else
{
TreeNode
r
=
child
(
l
,
!
is
l
eft
);
TreeNode
r
=
child
(
l
,
!
is
L
eft
);
replace
(
x
,
r
);
set
(
l
,
!
is
left
,
child
(
r
,
isl
eft
));
set
(
r
,
is
l
eft
,
l
);
set
(
x
,
is
left
,
child
(
r
,
!
isl
eft
));
set
(
r
,
!
is
l
eft
,
x
);
set
(
l
,
!
is
Left
,
child
(
r
,
isL
eft
));
set
(
r
,
is
L
eft
,
l
);
set
(
x
,
is
Left
,
child
(
r
,
!
isL
eft
));
set
(
r
,
!
is
L
eft
,
x
);
int
rb
=
r
.
balance
;
x
.
balance
=
(
rb
==
-
sign
)
?
sign
:
0
;
l
.
balance
=
(
rb
==
sign
)
?
-
sign
:
0
;
...
...
@@ -98,13 +98,13 @@ public class TreeIndex extends Index {
if
(
x
==
root
)
{
return
;
}
is
l
eft
=
x
.
isFromLeft
();
is
L
eft
=
x
.
isFromLeft
();
x
=
x
.
parent
;
}
}
private
TreeNode
child
(
TreeNode
x
,
boolean
is
l
eft
)
{
return
is
l
eft
?
x
.
left
:
x
.
right
;
private
TreeNode
child
(
TreeNode
x
,
boolean
is
L
eft
)
{
return
is
L
eft
?
x
.
left
:
x
.
right
;
}
private
void
replace
(
TreeNode
x
,
TreeNode
n
)
{
...
...
@@ -198,12 +198,12 @@ public class TreeIndex extends Index {
}
rowCount
--;
boolean
is
l
eft
=
x
.
isFromLeft
();
boolean
is
L
eft
=
x
.
isFromLeft
();
replace
(
x
,
n
);
n
=
x
.
parent
;
while
(
n
!=
null
)
{
x
=
n
;
int
sign
=
is
l
eft
?
1
:
-
1
;
int
sign
=
is
L
eft
?
1
:
-
1
;
switch
(
x
.
balance
*
sign
)
{
case
-
1
:
x
.
balance
=
0
;
...
...
@@ -212,12 +212,12 @@ public class TreeIndex extends Index {
x
.
balance
=
sign
;
return
;
case
1
:
TreeNode
r
=
child
(
x
,
!
is
l
eft
);
TreeNode
r
=
child
(
x
,
!
is
L
eft
);
int
b
=
r
.
balance
;
if
(
b
*
sign
>=
0
)
{
replace
(
x
,
r
);
set
(
x
,
!
is
left
,
child
(
r
,
isl
eft
));
set
(
r
,
is
l
eft
,
x
);
set
(
x
,
!
is
Left
,
child
(
r
,
isL
eft
));
set
(
r
,
is
L
eft
,
x
);
if
(
b
==
0
)
{
x
.
balance
=
sign
;
r
.
balance
=
-
sign
;
...
...
@@ -227,20 +227,20 @@ public class TreeIndex extends Index {
r
.
balance
=
0
;
x
=
r
;
}
else
{
TreeNode
l
=
child
(
r
,
is
l
eft
);
TreeNode
l
=
child
(
r
,
is
L
eft
);
replace
(
x
,
l
);
b
=
l
.
balance
;
set
(
r
,
is
left
,
child
(
l
,
!
isl
eft
));
set
(
l
,
!
is
l
eft
,
r
);
set
(
x
,
!
is
left
,
child
(
l
,
isl
eft
));
set
(
l
,
is
l
eft
,
x
);
set
(
r
,
is
Left
,
child
(
l
,
!
isL
eft
));
set
(
l
,
!
is
L
eft
,
r
);
set
(
x
,
!
is
Left
,
child
(
l
,
isL
eft
));
set
(
l
,
is
L
eft
,
x
);
x
.
balance
=
(
b
==
sign
)
?
-
sign
:
0
;
r
.
balance
=
(
b
==
-
sign
)
?
sign
:
0
;
l
.
balance
=
0
;
x
=
l
;
}
}
is
l
eft
=
x
.
isFromLeft
();
is
L
eft
=
x
.
isFromLeft
();
n
=
x
.
parent
;
}
}
...
...
h2/src/main/org/h2/index/ViewIndex.java
浏览文件 @
42715ee9
...
...
@@ -149,8 +149,10 @@ public class ViewIndex extends Index {
if
(
lastResult
!=
null
&&
canReuse
)
{
if
(
query
.
sameResultAsLast
(
session
,
params
,
lastParameters
,
lastEvaluated
))
{
lastResult
=
lastResult
.
createShallowCopy
(
session
);
lastResult
.
reset
();
return
new
ViewCursor
(
table
,
lastResult
);
if
(
lastResult
!=
null
)
{
lastResult
.
reset
();
return
new
ViewCursor
(
table
,
lastResult
);
}
}
}
}
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
42715ee9
...
...
@@ -54,7 +54,7 @@ import java.sql.SQLClientInfoException;
* Represents a connection (session) to a database.
*/
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!
private
String
url
;
...
...
@@ -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.
*
* @param autoCommit
* true for autocommit on, false for off
* true for auto
commit on, false for off
* @throws SQLException
* if the connection is closed
*/
...
...
@@ -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
* @throws SQLException
...
...
@@ -319,14 +319,14 @@ public class JdbcConnection extends TraceObject implements Connection {
getAutoCommit
=
prepareCommand
(
"CALL AUTOCOMMIT()"
,
getAutoCommit
);
ResultInterface
result
=
getAutoCommit
.
executeQuery
(
0
,
false
);
result
.
next
();
boolean
auto
c
ommit
=
result
.
currentRow
()[
0
].
getBoolean
().
booleanValue
();
boolean
auto
C
ommit
=
result
.
currentRow
()[
0
].
getBoolean
().
booleanValue
();
result
.
close
();
return
auto
c
ommit
;
return
auto
C
ommit
;
}
/**
* Commits the current transaction. This call has only an effect if
* autocommit is switched off.
* auto
commit is switched off.
*
* @throws SQLException
* if the connection is closed
...
...
@@ -344,7 +344,7 @@ public class JdbcConnection extends TraceObject implements Connection {
/**
* Rolls back the current transaction. This call has only an effect if
* autocommit is switched off.
* auto
commit is switched off.
*
* @throws SQLException
* if the connection is closed
...
...
@@ -1117,25 +1117,25 @@ public class JdbcConnection extends TraceObject implements Connection {
i
++;
checkRunOver
(
i
,
len
,
sql
);
}
int
re
pl
=
0
;
int
re
move
=
0
;
if
(
found
(
sql
,
start
,
"fn"
))
{
re
pl
=
2
;
re
move
=
2
;
}
else
if
(
found
(
sql
,
start
,
"escape"
))
{
break
;
}
else
if
(
found
(
sql
,
start
,
"call"
))
{
break
;
}
else
if
(
found
(
sql
,
start
,
"oj"
))
{
re
pl
=
2
;
re
move
=
2
;
}
else
if
(
found
(
sql
,
start
,
"ts"
))
{
re
pl
=
2
;
re
move
=
2
;
}
else
if
(
found
(
sql
,
start
,
"t"
))
{
re
pl
=
1
;
re
move
=
1
;
}
else
if
(
found
(
sql
,
start
,
"d"
))
{
re
pl
=
1
;
re
move
=
1
;
}
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
]
=
' '
;
}
break
;
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
42715ee9
...
...
@@ -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
*/
...
...
@@ -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
*/
...
...
@@ -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
*/
...
...
@@ -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
*/
...
...
@@ -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
*/
...
...
@@ -1974,7 +1974,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/**
* 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
*/
...
...
@@ -1985,7 +1985,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
/**
* 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
*/
...
...
@@ -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
*/
public
boolean
updatesAreDetected
(
int
type
)
{
...
...
@@ -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
*/
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
* 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
* 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
* was a create, drop, commit or rollback)
...
...
@@ -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
* 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
* @throws SQLException if this object is closed or invalid
...
...
@@ -251,7 +251,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* Sets a parameter to null.
*
* @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
*/
public
void
setNull
(
int
parameterIndex
,
int
sqlType
)
throws
SQLException
{
...
...
@@ -658,7 +658,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
* Sets a parameter to null.
*
* @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
* @throws SQLException if this object is closed
*/
...
...
@@ -998,7 +998,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
/**
* Executes the batch.
*
* @return the array of updatecounts
* @return the array of update
counts
*/
public
int
[]
executeBatch
()
throws
SQLException
{
try
{
...
...
@@ -1037,9 +1037,9 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
}
batchParameters
=
null
;
if
(
error
)
{
JdbcBatchUpdateException
bu
e
=
new
JdbcBatchUpdateException
(
next
,
result
);
bu
e
.
setNextException
(
next
);
throw
bu
e
;
JdbcBatchUpdateException
e
=
new
JdbcBatchUpdateException
(
next
,
result
);
e
.
setNextException
(
next
);
throw
e
;
}
return
result
;
}
catch
(
Throwable
e
)
{
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
42715ee9
...
...
@@ -59,7 +59,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* 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
{
try
{
...
...
@@ -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,...)
* @return the value or null
...
...
@@ -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
* @return the value or null
...
...
@@ -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
* 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
{
try
{
...
...
@@ -2294,8 +2294,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
try
{
debugCodeCall
(
"getConcurrency"
);
checkClosed
();
UpdatableRow
upd
=
new
UpdatableRow
(
conn
,
result
,
session
);
return
upd
.
isUpdatable
()
?
ResultSet
.
CONCUR_UPDATABLE
:
ResultSet
.
CONCUR_READ_ONLY
;
UpdatableRow
row
=
new
UpdatableRow
(
conn
,
result
,
session
);
return
row
.
isUpdatable
()
?
ResultSet
.
CONCUR_UPDATABLE
:
ResultSet
.
CONCUR_READ_ONLY
;
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
}
...
...
@@ -2783,11 +2783,11 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
private
UpdatableRow
getUpdatableRow
()
throws
SQLException
{
UpdatableRow
upd
=
new
UpdatableRow
(
conn
,
result
,
session
);
if
(!
upd
.
isUpdatable
())
{
UpdatableRow
row
=
new
UpdatableRow
(
conn
,
result
,
session
);
if
(!
row
.
isUpdatable
())
{
throw
Message
.
getSQLException
(
Message
.
NOT_ON_UPDATABLE_ROW
);
}
return
upd
;
return
row
;
}
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 {
*
* 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.
* If auto
commit is on, this statement will be committed.
*
* @param sql the SQL statement
* @return the update count (number of row affected by an insert,
...
...
@@ -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,
* 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
*/
...
...
@@ -585,7 +585,7 @@ public class JdbcStatement extends TraceObject implements Statement {
/**
* Executes the batch.
*
* @return the array of updatecounts
* @return the array of update
counts
*/
public
int
[]
executeBatch
()
throws
SQLException
{
try
{
...
...
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
42715ee9
...
...
@@ -70,14 +70,17 @@ implements XAConnection, XAResource, JdbcConnectionListener
Properties
info
=
new
Properties
();
info
.
setProperty
(
"user"
,
user
);
info
.
setProperty
(
"password"
,
password
);
conn
=
new
JdbcConnection
(
url
,
info
);
conn
=
new
JdbcConnection
(
url
,
info
);
conn
.
setJdbcConnectionListener
(
this
);
return
conn
;
}
public
void
addConnectionEventListener
(
ConnectionEventListener
listener
)
{
debugCode
(
"addConnectionEventListener(listener)"
);
listeners
.
add
(
listener
);
conn
.
setJdbcConnectionListener
(
this
);
if
(
conn
!=
null
)
{
conn
.
setJdbcConnectionListener
(
this
);
}
}
public
void
removeConnectionEventListener
(
ConnectionEventListener
listener
)
{
...
...
@@ -238,7 +241,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
buff
.
append
(
xid
.
getFormatId
());
buff
.
append
(
",bq:"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
xid
.
getBranchQualifier
()));
buff
.
append
(
",gx
id
:"
);
buff
.
append
(
",gx:"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
xid
.
getGlobalTransactionId
()));
buff
.
append
(
",c:"
);
buff
.
append
(
xid
.
getClass
().
getName
());
...
...
h2/src/main/org/h2/message/Message.java
浏览文件 @
42715ee9
...
...
@@ -23,7 +23,7 @@ public class Message {
private
static
final
Properties
MESSAGES
=
new
Properties
();
static
{
// TODO multilanguage messages
// TODO multi
language messages
// String language = Locale.getDefault().getLanguage();
try
{
byte
[]
messages
=
Resources
.
get
(
"/org/h2/res/messages.properties"
);
...
...
@@ -37,16 +37,14 @@ public class Message {
/**
* Gets the SQL Exception object for a specific SQLState. Supported
*
sql
states are:
*
SQL
states are:
*
* @param sqlstate -
* the SQL State
* @param param -
* the parameter of the message
* @param sqlState - the SQL State
* @param param - the parameter of the message
* @return the SQLException object
*/
public
static
JdbcSQLException
getSQLException
(
int
sql
s
tate
,
String
p1
)
{
return
getSQLException
(
sql
s
tate
,
new
String
[]
{
p1
},
null
);
public
static
JdbcSQLException
getSQLException
(
int
sql
S
tate
,
String
p1
)
{
return
getSQLException
(
sql
S
tate
,
new
String
[]
{
p1
},
null
);
}
public
static
String
translate
(
String
key
,
String
[]
param
)
{
...
...
@@ -360,8 +358,8 @@ public class Message {
if
(
e
instanceof
SQLException
)
{
return
(
SQLException
)
e
;
}
else
if
(
e
instanceof
InvocationTargetException
)
{
InvocationTargetException
i
te
=
(
InvocationTargetException
)
e
;
Throwable
t
=
i
te
.
getTargetException
();
InvocationTargetException
te
=
(
InvocationTargetException
)
e
;
Throwable
t
=
te
.
getTargetException
();
if
(
t
instanceof
SQLException
)
{
return
(
SQLException
)
t
;
}
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
42715ee9
...
...
@@ -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.
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,
or in
SERTS
the row if it does not yet exist.
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.
If more than one row per new row is affected, an exception is thrown.
","
MERGE INTO TEST KEY(ID) VALUES(2, 'World')
...
...
@@ -122,7 +122,7 @@ ALTER SEQUENCE sequenceName
","
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","
...
...
@@ -197,8 +197,8 @@ ALTER TABLE TEST ALTER COLUMN NAME SET DEFAULT ''
ALTER TABLE tableName ALTER COLUMN columnName
SET NOT NULL
","
Sets a column to not allow NULL
values
.
This is not possible if there are any
null values in the table
.
Sets a column to not allow NULL.
This is not possible if there are any
rows with NULL in this column
.
","
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
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.
If there are single column indexes on this column, they are dropped.
","
...
...
@@ -235,7 +235,7 @@ ALTER TABLE tableName RENAME TO newName
","
Renames a table.
","
ALTER TABLE TEST RENAME TO MYDATA
ALTER TABLE TEST RENAME TO MY
_
DATA
"
"Commands (DDL)","ALTER USER ADMIN","
...
...
@@ -331,7 +331,7 @@ CREATE DOMAIN [IF NOT EXISTS] newDomainName AS dataType
[CHECK condition]
","
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.
","
CREATE DOMAIN EMAIL AS VARCHAR(255) CHECK (POSITION('@', VALUE) > 1)
...
...
@@ -383,7 +383,7 @@ CREATE SEQUENCE [IF NOT EXISTS] newSequenceName
","
Creates a new sequence. The data type of a sequence is BIGINT.
","
CREATE SEQUENCE SEQID
CREATE SEQUENCE SEQ
_
ID
"
"Commands (DDL)","CREATE TABLE","
...
...
@@ -486,7 +486,7 @@ DROP SEQUENCE [IF EXISTS] sequenceName
","
Drops a sequence.
","
DROP SEQUENCE SEQID
DROP SEQUENCE SEQ
_
ID
"
"Commands (DDL)","DROP SCHEMA","
DROP SCHEMA [IF EXISTS] schemaName
...
...
@@ -679,7 +679,7 @@ SET ASSERT 0
"Commands (Other)","SET AUTOCOMMIT","
SET AUTOCOMMIT {TRUE | ON | FALSE | OFF}
","
Switches autocommit on or off.
Switches auto
commit on or off.
","
SET AUTOCOMMIT OFF
"
...
...
@@ -726,7 +726,7 @@ SET COLLATION ENGLISH
"Commands (Other)","SET COMPRESS_LOB","
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.
This setting is persistent.
Admin rights are required to execute this command.
...
...
@@ -930,7 +930,7 @@ SET PASSWORD string
Changes the password of the current user.
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","
...
...
@@ -1041,7 +1041,7 @@ CHECK expression
| referentialConstraint}
","
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)
"
...
...
@@ -2325,7 +2325,7 @@ YEAR(CREATED)
"Functions (System)","AUTOCOMMIT","
AUTOCOMMIT(): boolean
","
Returns true if autocommit is switched on for this session.
Returns true if auto
commit is switched on for this session.
","
AUTOCOMMIT()
"
...
...
@@ -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 sequence name is converted to uppercase (for compatibility).
","
CURRVAL('TESTSEQ')
CURRVAL('TEST
_
SEQ')
"
"Functions (System)","CSVREAD","
...
...
@@ -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 sequence name is converted to uppercase (for compatibility).
","
NEXTVAL('TESTSEQ')
NEXTVAL('TEST
_
SEQ')
"
"Functions (System)","NULLIF","
...
...
h2/src/main/org/h2/res/messages.properties
浏览文件 @
42715ee9
...
...
@@ -26,7 +26,7 @@
90003
=
Hexadecimal string with odd number of characters: {0}
90004
=
Hexadecimal string contains non hex character: {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
90008
=
Invalid value {0} for parameter {1}
90009
=
Cannot parse date constant {0}
...
...
@@ -116,7 +116,7 @@
90093
=
Clustering error - database currently runs in standalone mode
90094
=
Clustering error - database currently runs in cluster mode, server list: {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
90098
=
The database has been closed
90099
=
Error setting database event listener {0}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论