Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e08bf7a4
提交
e08bf7a4
authored
9 年前
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting
上级
7fefdea5
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
42 行增加
和
35 行删除
+42
-35
Session.java
h2/src/main/org/h2/engine/Session.java
+4
-1
CompareLike.java
h2/src/main/org/h2/expression/CompareLike.java
+2
-2
CipherFactory.java
h2/src/main/org/h2/security/CipherFactory.java
+7
-8
Data.java
h2/src/main/org/h2/store/Data.java
+2
-1
Column.java
h2/src/main/org/h2/table/Column.java
+1
-1
Table.java
h2/src/main/org/h2/table/Table.java
+1
-0
TableView.java
h2/src/main/org/h2/table/TableView.java
+1
-1
ToDateTokenizer.java
h2/src/main/org/h2/util/ToDateTokenizer.java
+7
-4
ValueTimestampTimeZone.java
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
+5
-5
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+9
-9
TestSecurity.java
h2/src/test/org/h2/test/unit/TestSecurity.java
+3
-3
没有找到文件。
h2/src/main/org/h2/engine/Session.java
浏览文件 @
e08bf7a4
...
...
@@ -815,7 +815,10 @@ public class Session extends SessionWithState {
if
(!
closed
)
{
try
{
database
.
checkPowerOff
();
rollback
();
// release any open table locks
// release any open table locks
rollback
();
removeTemporaryLobs
(
false
);
cleanTempTables
(
true
);
undoLog
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/CompareLike.java
浏览文件 @
e08bf7a4
...
...
@@ -259,7 +259,7 @@ public class CompareLike extends Condition {
if
(
regexp
)
{
result
=
patternRegexp
.
matcher
(
value
).
find
();
}
else
if
(
shortcutToStartsWith
)
{
result
=
value
.
regionMatches
(
ignoreCase
,
0
,
patternString
,
0
,
patternLength
-
1
);
result
=
value
.
regionMatches
(
ignoreCase
,
0
,
patternString
,
0
,
patternLength
-
1
);
}
else
{
result
=
compareAt
(
value
,
0
,
0
,
value
.
length
(),
patternChars
,
patternTypes
);
}
...
...
@@ -388,7 +388,7 @@ public class CompareLike extends Condition {
while
(
maxMatch
<
patternLength
&&
patternTypes
[
maxMatch
]
==
MATCH
)
{
maxMatch
++;
}
if
(
maxMatch
==
patternLength
-
1
&&
patternTypes
[
patternLength
-
1
]
==
ANY
)
{
if
(
maxMatch
==
patternLength
-
1
&&
patternTypes
[
patternLength
-
1
]
==
ANY
)
{
shortcutToStartsWith
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/security/CipherFactory.java
浏览文件 @
e08bf7a4
...
...
@@ -167,23 +167,22 @@ public class CipherFactory {
* Removes DH_anon and ECDH_anon from a comma separated list of ciphers.
* Only the first occurrence is removed.
* If there is nothing to remove, returns the reference to the argument.
* @param
commaSepL
ist a list of names separated by commas (and spaces)
* @param
l
ist a list of names separated by commas (and spaces)
* @return a new string without DH_anon and ECDH_anon items,
* or the original if none were found
*/
public
static
String
removeDhAnonFromCommaSep
List
(
String
commaSepL
ist
)
{
if
(
commaSepL
ist
==
null
)
{
return
commaSepL
ist
;
public
static
String
removeDhAnonFromCommaSep
aratedList
(
String
l
ist
)
{
if
(
l
ist
==
null
)
{
return
l
ist
;
}
List
<
String
>
algos
=
new
LinkedList
<
String
>(
Arrays
.
asList
(
commaSepL
ist
.
split
(
"\\s*,\\s*"
)));
List
<
String
>
algos
=
new
LinkedList
<
String
>(
Arrays
.
asList
(
l
ist
.
split
(
"\\s*,\\s*"
)));
boolean
dhAnonRemoved
=
algos
.
remove
(
"DH_anon"
);
boolean
ecdhAnonRemoved
=
algos
.
remove
(
"ECDH_anon"
);
if
(
dhAnonRemoved
||
ecdhAnonRemoved
)
{
String
algosStr
=
Arrays
.
toString
(
algos
.
toArray
(
new
String
[
algos
.
size
()]));
return
(
algos
.
size
()
>
0
)
?
algosStr
.
substring
(
1
,
algosStr
.
length
()
-
1
):
""
;
}
else
{
return
commaSepList
;
}
return
list
;
}
/**
...
...
@@ -206,7 +205,7 @@ public class CipherFactory {
if
(
legacyAlgosOrig
==
null
)
{
return
;
}
String
legacyAlgosNew
=
removeDhAnonFromCommaSepList
(
legacyAlgosOrig
);
String
legacyAlgosNew
=
removeDhAnonFromCommaSep
arated
List
(
legacyAlgosOrig
);
if
(!
legacyAlgosOrig
.
equals
(
legacyAlgosNew
))
{
setLegacyAlgorithmsSilently
(
legacyAlgosNew
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/Data.java
浏览文件 @
e08bf7a4
...
...
@@ -553,6 +553,7 @@ public class Data {
writeVarInt
(
ts
.
getTimeZoneOffsetMins
());
}
case
Value
.
GEOMETRY
:
// fall though
case
Value
.
JAVA_OBJECT
:
{
writeByte
((
byte
)
type
);
byte
[]
b
=
v
.
getBytesNoCopy
();
...
...
@@ -792,7 +793,7 @@ public class Data {
case
Value
.
TIMESTAMP_TZ
:
{
long
dateValue
=
readVarLong
();
long
nanos
=
readVarLong
();
short
tz
=
(
short
)
readVarInt
();
short
tz
=
(
short
)
readVarInt
();
return
ValueTimestampTimeZone
.
fromDateValueAndNanos
(
dateValue
,
nanos
,
tz
);
}
case
Value
.
BYTES
:
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Column.java
浏览文件 @
e08bf7a4
...
...
@@ -298,7 +298,7 @@ public class Column {
}
else
if
(
dt
.
type
==
Value
.
TIMESTAMP_UTC
)
{
value
=
ValueTimestampUtc
.
fromMillis
(
session
.
getTransactionStart
());
}
else
if
(
dt
.
type
==
Value
.
TIMESTAMP_TZ
)
{
value
=
ValueTimestampTimeZone
.
fromMillis
(
session
.
getTransactionStart
(),
(
short
)
0
);
value
=
ValueTimestampTimeZone
.
fromMillis
(
session
.
getTransactionStart
(),
(
short
)
0
);
}
else
if
(
dt
.
type
==
Value
.
TIME
)
{
value
=
ValueTime
.
fromNanos
(
0
);
}
else
if
(
dt
.
type
==
Value
.
DATE
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Table.java
浏览文件 @
e08bf7a4
...
...
@@ -248,6 +248,7 @@ public abstract class Table extends SchemaObjectBase {
* @param filters the table filters
* @param filter the filter index
* @param sortOrder the sort order
* @param allColumnsSet all columns
* @return the scan index
*/
public
Index
getScanIndex
(
Session
session
,
int
[]
masks
,
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableView.java
浏览文件 @
e08bf7a4
...
...
@@ -565,7 +565,7 @@ public class TableView extends Table {
return
result
+
1
;
}
private
int
getMaxParameterIndex
(
ArrayList
<
Parameter
>
parameters
)
{
private
static
int
getMaxParameterIndex
(
ArrayList
<
Parameter
>
parameters
)
{
int
result
=
-
1
;
for
(
Parameter
p
:
parameters
)
{
result
=
Math
.
max
(
result
,
p
.
getIndex
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/ToDateTokenizer.java
浏览文件 @
e08bf7a4
...
...
@@ -148,8 +148,9 @@ class ToDateTokenizer {
dateNr
=
Integer
.
parseInt
(
inputFragmentStr
);
// Gregorian calendar does not have a year 0.
// 0 = 0001 BC, -1 = 0002 BC, ... so we adjust
if
(
dateNr
==
0
)
if
(
dateNr
==
0
)
{
throwException
(
params
,
"Year may not be zero"
);
}
result
.
set
(
Calendar
.
YEAR
,
dateNr
>=
0
?
dateNr
:
dateNr
+
1
);
break
;
case
YYY:
...
...
@@ -166,13 +167,15 @@ class ToDateTokenizer {
PATTERN_TWO_TO_FOUR_DIGITS
,
params
,
formatTokenEnum
);
dateNr
=
Integer
.
parseInt
(
inputFragmentStr
);
if
(
inputFragmentStr
.
length
()
<
4
)
{
if
(
dateNr
<
50
)
if
(
dateNr
<
50
)
{
dateNr
+=
2000
;
else
if
(
dateNr
<
100
)
}
else
if
(
dateNr
<
100
)
{
dateNr
+=
1900
;
}
if
(
dateNr
==
0
)
}
if
(
dateNr
==
0
)
{
throwException
(
params
,
"Year may not be zero"
);
}
result
.
set
(
Calendar
.
YEAR
,
dateNr
);
break
;
case
RR:
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
浏览文件 @
e08bf7a4
...
...
@@ -58,7 +58,7 @@ public class ValueTimestampTimeZone extends Value {
if
(
timeNanos
<
0
||
timeNanos
>=
24L
*
60
*
60
*
1000
*
1000
*
1000
)
{
throw
new
IllegalArgumentException
(
"timeNanos out of range "
+
timeNanos
);
}
if
(
timeZoneOffsetMins
<
(-
12
*
60
)
||
timeZoneOffsetMins
>=
(
12
*
60
))
{
if
(
timeZoneOffsetMins
<
(-
12
*
60
)
||
timeZoneOffsetMins
>=
(
12
*
60
))
{
throw
new
IllegalArgumentException
(
"timeZoneOffsetMins out of range "
+
timeZoneOffsetMins
);
}
this
.
dateValue
=
dateValue
;
...
...
@@ -149,7 +149,7 @@ public class ValueTimestampTimeZone extends Value {
}
long
dateValue
=
DateTimeUtils
.
parseDateValue
(
s
,
0
,
dateEnd
);
long
nanos
;
short
tz
_min
s
=
0
;
short
tz
Minute
s
=
0
;
if
(
timeStart
<
0
)
{
nanos
=
0
;
}
else
{
...
...
@@ -183,12 +183,12 @@ public class ValueTimestampTimeZone extends Value {
}
if
(
tz
!=
null
)
{
long
millis
=
DateTimeUtils
.
convertDateValueToDate
(
dateValue
).
getTime
();
tz
_min
s
=
(
short
)
(
tz
.
getOffset
(
millis
)
/
1000
/
60
);
tz
Minute
s
=
(
short
)
(
tz
.
getOffset
(
millis
)
/
1000
/
60
);
}
}
nanos
=
DateTimeUtils
.
parseTimeNanos
(
s
,
dateEnd
+
1
,
timeEnd
,
true
);
}
return
ValueTimestampTimeZone
.
fromDateValueAndNanos
(
dateValue
,
nanos
,
tz
_min
s
);
return
ValueTimestampTimeZone
.
fromDateValueAndNanos
(
dateValue
,
nanos
,
tz
Minute
s
);
}
/**
...
...
@@ -250,7 +250,7 @@ public class ValueTimestampTimeZone extends Value {
private
static
void
appendTimeZone
(
StringBuilder
buff
,
short
tz
)
{
if
(
tz
<
0
)
{
buff
.
append
(
'-'
);
tz
=
(
short
)-
tz
;
tz
=
(
short
)
-
tz
;
}
int
hours
=
tz
/
60
;
tz
-=
hours
*
60
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
e08bf7a4
...
...
@@ -1413,15 +1413,15 @@ public class TestFunctions extends TestBase implements AggregateFunction {
SimpleDateFormat
ymd
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
assertEquals
(
ymd
.
parse
(
"0001-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-0001"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"9999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-9999"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"2000-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-000"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-099"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"0100-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-100"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"2000-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-00"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"2049-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-49"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1950-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-50"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-99"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"0001-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-0001"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"9999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-9999"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"2000-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-000"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-099"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"0100-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-100"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"2000-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-00"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"2049-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-49"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1950-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-50"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-99"
,
"DD-MON-RRRR"
));
}
private
static
void
setMonth
(
Date
date
,
int
month
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestSecurity.java
浏览文件 @
e08bf7a4
...
...
@@ -262,15 +262,15 @@ public class TestSecurity extends TestBase {
", DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, DH_RSA_EXPORT, RSA_EXPORT"
+
", RC4_128, RC4_40, DES_CBC, DES40_CBC"
;
assertEquals
(
expectedLegacyAlgosWithoutDhAnon
,
CipherFactory
.
removeDhAnonFromCommaSepList
(
legacyAlgos
));
CipherFactory
.
removeDhAnonFromCommaSep
arated
List
(
legacyAlgos
));
legacyAlgos
=
"ECDH_anon, DH_anon_EXPORT, DH_anon"
;
expectedLegacyAlgosWithoutDhAnon
=
"DH_anon_EXPORT"
;
assertEquals
(
expectedLegacyAlgosWithoutDhAnon
,
CipherFactory
.
removeDhAnonFromCommaSepList
(
legacyAlgos
));
CipherFactory
.
removeDhAnonFromCommaSep
arated
List
(
legacyAlgos
));
legacyAlgos
=
null
;
assertNull
(
CipherFactory
.
removeDhAnonFromCommaSepList
(
legacyAlgos
));
assertNull
(
CipherFactory
.
removeDhAnonFromCommaSep
arated
List
(
legacyAlgos
));
}
/**
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论