Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2f4fbec0
提交
2f4fbec0
authored
3月 12, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use _ in long numbers for readability
上级
aac42d22
隐藏空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
87 行增加
和
87 行删除
+87
-87
Command.java
h2/src/main/org/h2/command/Command.java
+2
-2
Query.java
h2/src/main/org/h2/command/dml/Query.java
+1
-1
Constants.java
h2/src/main/org/h2/engine/Constants.java
+5
-5
DbSettings.java
h2/src/main/org/h2/engine/DbSettings.java
+2
-2
SysProperties.java
h2/src/main/org/h2/engine/SysProperties.java
+2
-2
AggregateDataMedian.java
h2/src/main/org/h2/expression/AggregateDataMedian.java
+1
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-2
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+1
-1
FileStore.java
h2/src/main/org/h2/mvstore/FileStore.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+1
-1
ObjectDataType.java
h2/src/main/org/h2/mvstore/type/ObjectDataType.java
+1
-1
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+1
-1
Data.java
h2/src/main/org/h2/store/Data.java
+12
-12
LobStorageBackend.java
h2/src/main/org/h2/store/LobStorageBackend.java
+1
-1
FilePathNioMapped.java
h2/src/main/org/h2/store/fs/FilePathNioMapped.java
+1
-1
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+1
-1
CompressTool.java
h2/src/main/org/h2/tools/CompressTool.java
+5
-5
DateTimeUtils.java
h2/src/main/org/h2/util/DateTimeUtils.java
+34
-34
MathUtils.java
h2/src/main/org/h2/util/MathUtils.java
+1
-1
ThreadDeadlockDetector.java
h2/src/main/org/h2/util/ThreadDeadlockDetector.java
+1
-1
ToDateParser.java
h2/src/main/org/h2/util/ToDateParser.java
+2
-2
Transfer.java
h2/src/main/org/h2/value/Transfer.java
+4
-4
ValueDecimal.java
h2/src/main/org/h2/value/ValueDecimal.java
+1
-1
ValueTime.java
h2/src/main/org/h2/value/ValueTime.java
+1
-1
ValueTimestamp.java
h2/src/main/org/h2/value/ValueTimestamp.java
+1
-1
ValueUuid.java
h2/src/main/org/h2/value/ValueUuid.java
+1
-1
DirectInsert.java
h2/src/test/org/h2/samples/DirectInsert.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/Command.java
浏览文件 @
2f4fbec0
...
@@ -311,7 +311,7 @@ public abstract class Command implements CommandInterface {
...
@@ -311,7 +311,7 @@ public abstract class Command implements CommandInterface {
errorCode
!=
ErrorCode
.
ROW_NOT_FOUND_WHEN_DELETING_1
)
{
errorCode
!=
ErrorCode
.
ROW_NOT_FOUND_WHEN_DELETING_1
)
{
throw
e
;
throw
e
;
}
}
long
now
=
System
.
nanoTime
()
/
1
000
000
;
long
now
=
System
.
nanoTime
()
/
1
_000_
000
;
if
(
start
!=
0
&&
now
-
start
>
session
.
getLockTimeout
())
{
if
(
start
!=
0
&&
now
-
start
>
session
.
getLockTimeout
())
{
throw
DbException
.
get
(
ErrorCode
.
LOCK_TIMEOUT_1
,
e
.
getCause
(),
""
);
throw
DbException
.
get
(
ErrorCode
.
LOCK_TIMEOUT_1
,
e
.
getCause
(),
""
);
}
}
...
@@ -327,7 +327,7 @@ public abstract class Command implements CommandInterface {
...
@@ -327,7 +327,7 @@ public abstract class Command implements CommandInterface {
}
catch
(
InterruptedException
e1
)
{
}
catch
(
InterruptedException
e1
)
{
// ignore
// ignore
}
}
long
slept
=
System
.
nanoTime
()
/
1
000
000
-
now
;
long
slept
=
System
.
nanoTime
()
/
1
_000_
000
-
now
;
if
(
slept
>=
sleep
)
{
if
(
slept
>=
sleep
)
{
break
;
break
;
}
}
...
...
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
2f4fbec0
...
@@ -149,7 +149,7 @@ public abstract class Query extends Prepared {
...
@@ -149,7 +149,7 @@ public abstract class Query extends Prepared {
public
int
getCostAsExpression
()
{
public
int
getCostAsExpression
()
{
// ensure the cost is not larger than 1 million,
// ensure the cost is not larger than 1 million,
// so that adding other values can't overflow
// so that adding other values can't overflow
return
(
int
)
Math
.
min
(
1
000000.0
,
10.0
+
10.0
*
getCost
());
return
(
int
)
Math
.
min
(
1
_000_000
d
,
10
d
+
10
d
*
getCost
());
}
}
/**
/**
...
...
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
2f4fbec0
...
@@ -246,12 +246,12 @@ public class Constants {
...
@@ -246,12 +246,12 @@ public class Constants {
/**
/**
* The default value for the MAX_MEMORY_UNDO setting.
* The default value for the MAX_MEMORY_UNDO setting.
*/
*/
public
static
final
int
DEFAULT_MAX_MEMORY_UNDO
=
50000
;
public
static
final
int
DEFAULT_MAX_MEMORY_UNDO
=
50
_
000
;
/**
/**
* The default for the setting MAX_OPERATION_MEMORY.
* The default for the setting MAX_OPERATION_MEMORY.
*/
*/
public
static
final
int
DEFAULT_MAX_OPERATION_MEMORY
=
100000
;
public
static
final
int
DEFAULT_MAX_OPERATION_MEMORY
=
100
_
000
;
/**
/**
* The default page size to use for new databases.
* The default page size to use for new databases.
...
@@ -312,7 +312,7 @@ public class Constants {
...
@@ -312,7 +312,7 @@ public class Constants {
/**
/**
* The highest possible parameter index.
* The highest possible parameter index.
*/
*/
public
static
final
int
MAX_PARAMETER_INDEX
=
100000
;
public
static
final
int
MAX_PARAMETER_INDEX
=
100
_
000
;
/**
/**
* The memory needed by a object of class Data
* The memory needed by a object of class Data
...
@@ -404,7 +404,7 @@ public class Constants {
...
@@ -404,7 +404,7 @@ public class Constants {
/**
/**
* The number of distinct values to keep in memory when running ANALYZE.
* The number of distinct values to keep in memory when running ANALYZE.
*/
*/
public
static
final
int
SELECTIVITY_DISTINCT_COUNT
=
10000
;
public
static
final
int
SELECTIVITY_DISTINCT_COUNT
=
10
_
000
;
/**
/**
* The default directory name of the server properties file for the H2
* The default directory name of the server properties file for the H2
...
@@ -512,7 +512,7 @@ public class Constants {
...
@@ -512,7 +512,7 @@ public class Constants {
* The maximum time in milliseconds to keep the cost of a view.
* The maximum time in milliseconds to keep the cost of a view.
* 10000 means 10 seconds.
* 10000 means 10 seconds.
*/
*/
public
static
final
int
VIEW_COST_CACHE_MAX_AGE
=
10000
;
public
static
final
int
VIEW_COST_CACHE_MAX_AGE
=
10
_
000
;
/**
/**
* The name of the index cache that is used for temporary view (subqueries
* The name of the index cache that is used for temporary view (subqueries
...
...
h2/src/main/org/h2/engine/DbSettings.java
浏览文件 @
2f4fbec0
...
@@ -54,7 +54,7 @@ public class DbSettings extends SettingsBase {
...
@@ -54,7 +54,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>ANALYZE_SAMPLE</code> (default: 10000).<br />
* Database setting <code>ANALYZE_SAMPLE</code> (default: 10000).<br />
* The default sample size when analyzing a table.
* The default sample size when analyzing a table.
*/
*/
public
final
int
analyzeSample
=
get
(
"ANALYZE_SAMPLE"
,
10000
);
public
final
int
analyzeSample
=
get
(
"ANALYZE_SAMPLE"
,
10
_
000
);
/**
/**
* Database setting <code>DATABASE_TO_UPPER</code> (default: true).<br />
* Database setting <code>DATABASE_TO_UPPER</code> (default: true).<br />
...
@@ -144,7 +144,7 @@ public class DbSettings extends SettingsBase {
...
@@ -144,7 +144,7 @@ public class DbSettings extends SettingsBase {
* times out. After the timeout, the LOB is no longer accessible using this
* times out. After the timeout, the LOB is no longer accessible using this
* reference.
* reference.
*/
*/
public
final
int
lobTimeout
=
get
(
"LOB_TIMEOUT"
,
300000
);
public
final
int
lobTimeout
=
get
(
"LOB_TIMEOUT"
,
300
_
000
);
/**
/**
* Database setting <code>MAX_COMPACT_COUNT</code>
* Database setting <code>MAX_COMPACT_COUNT</code>
...
...
h2/src/main/org/h2/engine/SysProperties.java
浏览文件 @
2f4fbec0
...
@@ -129,7 +129,7 @@ public class SysProperties {
...
@@ -129,7 +129,7 @@ public class SysProperties {
* been set for the database.
* been set for the database.
*/
*/
public
static
final
int
COLLATOR_CACHE_SIZE
=
public
static
final
int
COLLATOR_CACHE_SIZE
=
Utils
.
getProperty
(
"h2.collatorCacheSize"
,
32000
);
Utils
.
getProperty
(
"h2.collatorCacheSize"
,
32
_
000
);
/**
/**
* System property <code>h2.consoleTableIndexes</code>
* System property <code>h2.consoleTableIndexes</code>
...
@@ -260,7 +260,7 @@ public class SysProperties {
...
@@ -260,7 +260,7 @@ public class SysProperties {
* The default maximum number of rows to be kept in memory in a result set.
* The default maximum number of rows to be kept in memory in a result set.
*/
*/
public
static
final
int
MAX_MEMORY_ROWS
=
public
static
final
int
MAX_MEMORY_ROWS
=
getAutoScaledForMemoryProperty
(
"h2.maxMemoryRows"
,
40000
);
getAutoScaledForMemoryProperty
(
"h2.maxMemoryRows"
,
40
_
000
);
/**
/**
* System property <code>h2.maxTraceDataLength</code>
* System property <code>h2.maxTraceDataLength</code>
...
...
h2/src/main/org/h2/expression/AggregateDataMedian.java
浏览文件 @
2f4fbec0
...
@@ -259,7 +259,7 @@ class AggregateDataMedian extends AggregateData {
...
@@ -259,7 +259,7 @@ class AggregateDataMedian extends AggregateData {
nanos
+=
DateTimeUtils
.
NANOS_PER_DAY
/
2
;
nanos
+=
DateTimeUtils
.
NANOS_PER_DAY
/
2
;
}
}
if
((
offset
&
1
)
!=
0
)
{
if
((
offset
&
1
)
!=
0
)
{
nanos
+=
30
L
*
1000000000
;
nanos
+=
30
_000_000_000L
;
}
}
if
(
nanos
>=
DateTimeUtils
.
NANOS_PER_DAY
)
{
if
(
nanos
>=
DateTimeUtils
.
NANOS_PER_DAY
)
{
nanos
-=
DateTimeUtils
.
NANOS_PER_DAY
;
nanos
-=
DateTimeUtils
.
NANOS_PER_DAY
;
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
2f4fbec0
...
@@ -2234,10 +2234,10 @@ public class Function extends Expression implements FunctionCall {
...
@@ -2234,10 +2234,10 @@ public class Function extends Expression implements FunctionCall {
}
}
private
static
double
roundMagic
(
double
d
)
{
private
static
double
roundMagic
(
double
d
)
{
if
((
d
<
0.000
0000000001
)
&&
(
d
>
-
0.000000000000
1
))
{
if
((
d
<
0.000
_000_000_000_1
)
&&
(
d
>
-
0.000_000_000_000_
1
))
{
return
0.0
;
return
0.0
;
}
}
if
((
d
>
1
000000000000
.)
||
(
d
<
-
1000000000000
.
))
{
if
((
d
>
1
_000_000_000_000
d
)
||
(
d
<
-
1_000_000_000_000
d
))
{
return
d
;
return
d
;
}
}
StringBuilder
s
=
new
StringBuilder
();
StringBuilder
s
=
new
StringBuilder
();
...
...
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
2f4fbec0
...
@@ -143,7 +143,7 @@ public class PageDataIndex extends PageIndex {
...
@@ -143,7 +143,7 @@ public class PageDataIndex extends PageIndex {
if
(
add
==
0
)
{
if
(
add
==
0
)
{
// in the first re-try add a small random number,
// in the first re-try add a small random number,
// to avoid collisions after a re-start
// to avoid collisions after a re-start
row
.
setKey
((
long
)
(
row
.
getKey
()
+
Math
.
random
()
*
10000
));
row
.
setKey
((
long
)
(
row
.
getKey
()
+
Math
.
random
()
*
10
_
000
));
}
else
{
}
else
{
row
.
setKey
(
row
.
getKey
()
+
add
);
row
.
setKey
(
row
.
getKey
()
+
add
);
}
}
...
...
h2/src/main/org/h2/mvstore/FileStore.java
浏览文件 @
2f4fbec0
...
@@ -314,7 +314,7 @@ public class FileStore {
...
@@ -314,7 +314,7 @@ public class FileStore {
* @return the retention time
* @return the retention time
*/
*/
public
int
getDefaultRetentionTime
()
{
public
int
getDefaultRetentionTime
()
{
return
45000
;
return
45
_
000
;
}
}
/**
/**
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
2f4fbec0
...
@@ -141,7 +141,7 @@ public final class MVStore {
...
@@ -141,7 +141,7 @@ public final class MVStore {
* Used to mark a chunk as free, when it was detected that live bookkeeping
* Used to mark a chunk as free, when it was detected that live bookkeeping
* is incorrect.
* is incorrect.
*/
*/
private
static
final
int
MARKED_FREE
=
10
000
000
;
private
static
final
int
MARKED_FREE
=
10
_000_
000
;
/**
/**
* The background thread, if any.
* The background thread, if any.
...
...
h2/src/main/org/h2/mvstore/type/ObjectDataType.java
浏览文件 @
2f4fbec0
...
@@ -1479,7 +1479,7 @@ public class ObjectDataType implements DataType {
...
@@ -1479,7 +1479,7 @@ public class ObjectDataType implements DataType {
*/
*/
static
class
SerializedObjectType
extends
AutoDetectDataType
{
static
class
SerializedObjectType
extends
AutoDetectDataType
{
private
int
averageSize
=
10000
;
private
int
averageSize
=
10
_
000
;
SerializedObjectType
(
ObjectDataType
base
)
{
SerializedObjectType
(
ObjectDataType
base
)
{
super
(
base
,
TYPE_SERIALIZED_OBJECT
);
super
(
base
,
TYPE_SERIALIZED_OBJECT
);
...
...
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
2f4fbec0
...
@@ -1775,7 +1775,7 @@ public class WebApp {
...
@@ -1775,7 +1775,7 @@ public class WebApp {
String
d
=
rs
.
getString
(
columnIndex
);
String
d
=
rs
.
getString
(
columnIndex
);
if
(
d
==
null
)
{
if
(
d
==
null
)
{
return
"<i>null</i>"
;
return
"<i>null</i>"
;
}
else
if
(
d
.
length
()
>
100000
)
{
}
else
if
(
d
.
length
()
>
100
_
000
)
{
String
s
;
String
s
;
if
(
isBinary
(
rs
.
getMetaData
().
getColumnType
(
columnIndex
)))
{
if
(
isBinary
(
rs
.
getMetaData
().
getColumnType
(
columnIndex
)))
{
s
=
PageParser
.
escapeHtml
(
d
.
substring
(
0
,
6
))
+
s
=
PageParser
.
escapeHtml
(
d
.
substring
(
0
,
6
))
+
...
...
h2/src/main/org/h2/store/Data.java
浏览文件 @
2f4fbec0
...
@@ -491,8 +491,8 @@ public class Data {
...
@@ -491,8 +491,8 @@ public class Data {
writeByte
((
byte
)
LOCAL_TIME
);
writeByte
((
byte
)
LOCAL_TIME
);
ValueTime
t
=
(
ValueTime
)
v
;
ValueTime
t
=
(
ValueTime
)
v
;
long
nanos
=
t
.
getNanos
();
long
nanos
=
t
.
getNanos
();
long
millis
=
nanos
/
1
000
000
;
long
millis
=
nanos
/
1
_000_
000
;
nanos
-=
millis
*
1
000
000
;
nanos
-=
millis
*
1
_000_
000
;
writeVarLong
(
millis
);
writeVarLong
(
millis
);
writeVarLong
(
nanos
);
writeVarLong
(
nanos
);
}
else
{
}
else
{
...
@@ -519,15 +519,15 @@ public class Data {
...
@@ -519,15 +519,15 @@ public class Data {
long
dateValue
=
ts
.
getDateValue
();
long
dateValue
=
ts
.
getDateValue
();
writeVarLong
(
dateValue
);
writeVarLong
(
dateValue
);
long
nanos
=
ts
.
getTimeNanos
();
long
nanos
=
ts
.
getTimeNanos
();
long
millis
=
nanos
/
1
000
000
;
long
millis
=
nanos
/
1
_000_
000
;
nanos
-=
millis
*
1
000
000
;
nanos
-=
millis
*
1
_000_
000
;
writeVarLong
(
millis
);
writeVarLong
(
millis
);
writeVarLong
(
nanos
);
writeVarLong
(
nanos
);
}
else
{
}
else
{
Timestamp
ts
=
v
.
getTimestamp
();
Timestamp
ts
=
v
.
getTimestamp
();
writeByte
((
byte
)
type
);
writeByte
((
byte
)
type
);
writeVarLong
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
));
writeVarLong
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
));
writeVarInt
(
ts
.
getNanos
()
%
1
000
000
);
writeVarInt
(
ts
.
getNanos
()
%
1
_000_
000
);
}
}
break
;
break
;
}
}
...
@@ -758,7 +758,7 @@ public class Data {
...
@@ -758,7 +758,7 @@ public class Data {
return
ValueDate
.
fromMillis
(
DateTimeUtils
.
getTimeUTCWithoutDst
(
x
));
return
ValueDate
.
fromMillis
(
DateTimeUtils
.
getTimeUTCWithoutDst
(
x
));
}
}
case
LOCAL_TIME:
{
case
LOCAL_TIME:
{
long
nanos
=
readVarLong
()
*
1
000
000
+
readVarLong
();
long
nanos
=
readVarLong
()
*
1
_000_
000
+
readVarLong
();
return
ValueTime
.
fromNanos
(
nanos
);
return
ValueTime
.
fromNanos
(
nanos
);
}
}
case
Value
.
TIME
:
case
Value
.
TIME
:
...
@@ -767,7 +767,7 @@ public class Data {
...
@@ -767,7 +767,7 @@ public class Data {
DateTimeUtils
.
getTimeUTCWithoutDst
(
readVarLong
()));
DateTimeUtils
.
getTimeUTCWithoutDst
(
readVarLong
()));
case
LOCAL_TIMESTAMP:
{
case
LOCAL_TIMESTAMP:
{
long
dateValue
=
readVarLong
();
long
dateValue
=
readVarLong
();
long
nanos
=
readVarLong
()
*
1
000
000
+
readVarLong
();
long
nanos
=
readVarLong
()
*
1
_000_
000
+
readVarLong
();
return
ValueTimestamp
.
fromDateValueAndNanos
(
dateValue
,
nanos
);
return
ValueTimestamp
.
fromDateValueAndNanos
(
dateValue
,
nanos
);
}
}
case
Value
.
TIMESTAMP
:
{
case
Value
.
TIMESTAMP
:
{
...
@@ -1003,8 +1003,8 @@ public class Data {
...
@@ -1003,8 +1003,8 @@ public class Data {
case
Value
.
TIME
:
case
Value
.
TIME
:
if
(
STORE_LOCAL_TIME
)
{
if
(
STORE_LOCAL_TIME
)
{
long
nanos
=
((
ValueTime
)
v
).
getNanos
();
long
nanos
=
((
ValueTime
)
v
).
getNanos
();
long
millis
=
nanos
/
1
000
000
;
long
millis
=
nanos
/
1
_000_
000
;
nanos
-=
millis
*
1
000
000
;
nanos
-=
millis
*
1
_000_
000
;
return
1
+
getVarLongLen
(
millis
)
+
getVarLongLen
(
nanos
);
return
1
+
getVarLongLen
(
millis
)
+
getVarLongLen
(
nanos
);
}
}
return
1
+
getVarLongLen
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getTime
()));
return
1
+
getVarLongLen
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getTime
()));
...
@@ -1021,14 +1021,14 @@ public class Data {
...
@@ -1021,14 +1021,14 @@ public class Data {
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
long
dateValue
=
ts
.
getDateValue
();
long
dateValue
=
ts
.
getDateValue
();
long
nanos
=
ts
.
getTimeNanos
();
long
nanos
=
ts
.
getTimeNanos
();
long
millis
=
nanos
/
1
000
000
;
long
millis
=
nanos
/
1
_000_
000
;
nanos
-=
millis
*
1
000
000
;
nanos
-=
millis
*
1
_000_
000
;
return
1
+
getVarLongLen
(
dateValue
)
+
getVarLongLen
(
millis
)
+
return
1
+
getVarLongLen
(
dateValue
)
+
getVarLongLen
(
millis
)
+
getVarLongLen
(
nanos
);
getVarLongLen
(
nanos
);
}
}
Timestamp
ts
=
v
.
getTimestamp
();
Timestamp
ts
=
v
.
getTimestamp
();
return
1
+
getVarLongLen
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
))
+
return
1
+
getVarLongLen
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
))
+
getVarIntLen
(
ts
.
getNanos
()
%
1
000
000
);
getVarIntLen
(
ts
.
getNanos
()
%
1
_000_
000
);
}
}
case
Value
.
TIMESTAMP_TZ
:
{
case
Value
.
TIMESTAMP_TZ
:
{
ValueTimestampTimeZone
ts
=
(
ValueTimestampTimeZone
)
v
;
ValueTimestampTimeZone
ts
=
(
ValueTimestampTimeZone
)
v
;
...
...
h2/src/main/org/h2/store/LobStorageBackend.java
浏览文件 @
2f4fbec0
...
@@ -78,7 +78,7 @@ public class LobStorageBackend implements LobStorageInterface {
...
@@ -78,7 +78,7 @@ public class LobStorageBackend implements LobStorageInterface {
/**
/**
* The size of the chunks we use when storing LOBs inside the database file.
* The size of the chunks we use when storing LOBs inside the database file.
*/
*/
private
static
final
int
BLOCK_LENGTH
=
20000
;
private
static
final
int
BLOCK_LENGTH
=
20
_
000
;
/**
/**
* The size of cache for lob block hashes. Each entry needs 2 longs (16
* The size of cache for lob block hashes. Each entry needs 2 longs (16
...
...
h2/src/main/org/h2/store/fs/FilePathNioMapped.java
浏览文件 @
2f4fbec0
...
@@ -44,7 +44,7 @@ public class FilePathNioMapped extends FilePathNio {
...
@@ -44,7 +44,7 @@ public class FilePathNioMapped extends FilePathNio {
*/
*/
class
FileNioMapped
extends
FileBase
{
class
FileNioMapped
extends
FileBase
{
private
static
final
long
GC_TIMEOUT_MS
=
10000
;
private
static
final
long
GC_TIMEOUT_MS
=
10
_
000
;
private
final
String
name
;
private
final
String
name
;
private
final
MapMode
mode
;
private
final
MapMode
mode
;
private
RandomAccessFile
file
;
private
RandomAccessFile
file
;
...
...
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
2f4fbec0
...
@@ -47,7 +47,7 @@ public class TableLink extends Table {
...
@@ -47,7 +47,7 @@ public class TableLink extends Table {
private
static
final
int
MAX_RETRY
=
2
;
private
static
final
int
MAX_RETRY
=
2
;
private
static
final
long
ROW_COUNT_APPROXIMATION
=
100000
;
private
static
final
long
ROW_COUNT_APPROXIMATION
=
100
_
000
;
private
final
String
originalSchema
;
private
final
String
originalSchema
;
private
String
driver
,
url
,
user
,
password
,
originalTable
,
qualifiedTableName
;
private
String
driver
,
url
,
user
,
password
,
originalTable
,
qualifiedTableName
;
...
...
h2/src/main/org/h2/tools/CompressTool.java
浏览文件 @
2f4fbec0
...
@@ -181,13 +181,13 @@ public class CompressTool {
...
@@ -181,13 +181,13 @@ public class CompressTool {
buff
[
pos
++]
=
(
byte
)
(
0x80
|
(
x
>>
8
));
buff
[
pos
++]
=
(
byte
)
(
0x80
|
(
x
>>
8
));
buff
[
pos
]
=
(
byte
)
x
;
buff
[
pos
]
=
(
byte
)
x
;
return
2
;
return
2
;
}
else
if
(
x
<
0x200000
)
{
}
else
if
(
x
<
0x20
_
0000
)
{
buff
[
pos
++]
=
(
byte
)
(
0xc0
|
(
x
>>
16
));
buff
[
pos
++]
=
(
byte
)
(
0xc0
|
(
x
>>
16
));
buff
[
pos
++]
=
(
byte
)
(
x
>>
8
);
buff
[
pos
++]
=
(
byte
)
(
x
>>
8
);
buff
[
pos
]
=
(
byte
)
x
;
buff
[
pos
]
=
(
byte
)
x
;
return
3
;
return
3
;
}
else
if
(
x
<
0x10000000
)
{
}
else
if
(
x
<
0x1000
_
0000
)
{
Bits
.
writeInt
(
buff
,
pos
,
x
|
0xe0000000
);
Bits
.
writeInt
(
buff
,
pos
,
x
|
0xe000
_
0000
);
return
4
;
return
4
;
}
else
{
}
else
{
buff
[
pos
++]
=
(
byte
)
0xf0
;
buff
[
pos
++]
=
(
byte
)
0xf0
;
...
@@ -210,9 +210,9 @@ public class CompressTool {
...
@@ -210,9 +210,9 @@ public class CompressTool {
return
1
;
return
1
;
}
else
if
(
x
<
0x4000
)
{
}
else
if
(
x
<
0x4000
)
{
return
2
;
return
2
;
}
else
if
(
x
<
0x200000
)
{
}
else
if
(
x
<
0x20
_
0000
)
{
return
3
;
return
3
;
}
else
if
(
x
<
0x10000000
)
{
}
else
if
(
x
<
0x1000
_
0000
)
{
return
4
;
return
4
;
}
else
{
}
else
{
return
5
;
return
5
;
...
...
h2/src/main/org/h2/util/DateTimeUtils.java
浏览文件 @
2f4fbec0
...
@@ -50,7 +50,7 @@ public class DateTimeUtils {
...
@@ -50,7 +50,7 @@ public class DateTimeUtils {
/**
/**
* The number of nanoseconds per day.
* The number of nanoseconds per day.
*/
*/
public
static
final
long
NANOS_PER_DAY
=
MILLIS_PER_DAY
*
1
000
000
;
public
static
final
long
NANOS_PER_DAY
=
MILLIS_PER_DAY
*
1
_000_
000
;
private
static
final
int
SHIFT_YEAR
=
9
;
private
static
final
int
SHIFT_YEAR
=
9
;
private
static
final
int
SHIFT_MONTH
=
5
;
private
static
final
int
SHIFT_MONTH
=
5
;
...
@@ -229,10 +229,10 @@ public class DateTimeUtils {
...
@@ -229,10 +229,10 @@ public class DateTimeUtils {
cal
.
clear
();
cal
.
clear
();
cal
.
setLenient
(
true
);
cal
.
setLenient
(
true
);
long
nanos
=
t
.
getNanos
();
long
nanos
=
t
.
getNanos
();
long
millis
=
nanos
/
1
000
000
;
long
millis
=
nanos
/
1
_000_
000
;
nanos
-=
millis
*
1
000
000
;
nanos
-=
millis
*
1
_000_
000
;
long
s
=
millis
/
1000
;
long
s
=
millis
/
1
_
000
;
millis
-=
s
*
1000
;
millis
-=
s
*
1
_
000
;
long
m
=
s
/
60
;
long
m
=
s
/
60
;
s
-=
m
*
60
;
s
-=
m
*
60
;
long
h
=
m
/
60
;
long
h
=
m
/
60
;
...
@@ -257,10 +257,10 @@ public class DateTimeUtils {
...
@@ -257,10 +257,10 @@ public class DateTimeUtils {
cal
.
setLenient
(
true
);
cal
.
setLenient
(
true
);
long
dateValue
=
ts
.
getDateValue
();
long
dateValue
=
ts
.
getDateValue
();
long
nanos
=
ts
.
getTimeNanos
();
long
nanos
=
ts
.
getTimeNanos
();
long
millis
=
nanos
/
1
000
000
;
long
millis
=
nanos
/
1
_000_
000
;
nanos
-=
millis
*
1
000
000
;
nanos
-=
millis
*
1
_000_
000
;
long
s
=
millis
/
1000
;
long
s
=
millis
/
1
_
000
;
millis
-=
s
*
1000
;
millis
-=
s
*
1
_
000
;
long
m
=
s
/
60
;
long
m
=
s
/
60
;
s
-=
m
*
60
;
s
-=
m
*
60
;
long
h
=
m
/
60
;
long
h
=
m
/
60
;
...
@@ -269,7 +269,7 @@ public class DateTimeUtils {
...
@@ -269,7 +269,7 @@ public class DateTimeUtils {
monthFromDateValue
(
dateValue
),
dayFromDateValue
(
dateValue
),
monthFromDateValue
(
dateValue
),
dayFromDateValue
(
dateValue
),
(
int
)
h
,
(
int
)
m
,
(
int
)
s
,
(
int
)
millis
);
(
int
)
h
,
(
int
)
m
,
(
int
)
s
,
(
int
)
millis
);
Timestamp
x
=
new
Timestamp
(
ms
);
Timestamp
x
=
new
Timestamp
(
ms
);
x
.
setNanos
((
int
)
(
nanos
+
millis
*
1
000
000
));
x
.
setNanos
((
int
)
(
nanos
+
millis
*
1
_000_
000
));
return
x
;
return
x
;
}
}
...
@@ -323,7 +323,7 @@ public class DateTimeUtils {
...
@@ -323,7 +323,7 @@ public class DateTimeUtils {
cal
.
setTimeInMillis
(
x
.
getTime
());
cal
.
setTimeInMillis
(
x
.
getTime
());
long
dateValue
=
dateValueFromCalendar
(
cal
);
long
dateValue
=
dateValueFromCalendar
(
cal
);
long
nanos
=
nanosFromCalendar
(
cal
);
long
nanos
=
nanosFromCalendar
(
cal
);
nanos
+=
x
.
getNanos
()
%
1
000
000
;
nanos
+=
x
.
getNanos
()
%
1
_000_
000
;
return
ValueTimestamp
.
fromDateValueAndNanos
(
dateValue
,
nanos
);
return
ValueTimestamp
.
fromDateValueAndNanos
(
dateValue
,
nanos
);
}
}
...
@@ -408,14 +408,14 @@ public class DateTimeUtils {
...
@@ -408,14 +408,14 @@ public class DateTimeUtils {
String
n
=
(
s
.
substring
(
s3
+
1
,
end
)
+
"000000000"
).
substring
(
0
,
9
);
String
n
=
(
s
.
substring
(
s3
+
1
,
end
)
+
"000000000"
).
substring
(
0
,
9
);
nanos
=
Integer
.
parseInt
(
n
);
nanos
=
Integer
.
parseInt
(
n
);
}
}
if
(
hour
>=
2
000
000
||
minute
<
0
||
minute
>=
60
||
second
<
0
if
(
hour
>=
2
_000_
000
||
minute
<
0
||
minute
>=
60
||
second
<
0
||
second
>=
60
)
{
||
second
>=
60
)
{
throw
new
IllegalArgumentException
(
s
);
throw
new
IllegalArgumentException
(
s
);
}
}
if
(
timeOfDay
&&
hour
>=
24
)
{
if
(
timeOfDay
&&
hour
>=
24
)
{
throw
new
IllegalArgumentException
(
s
);
throw
new
IllegalArgumentException
(
s
);
}
}
nanos
+=
((((
hour
*
60L
)
+
minute
)
*
60
)
+
second
)
*
1
000000
000
;
nanos
+=
((((
hour
*
60L
)
+
minute
)
*
60
)
+
second
)
*
1
_000_000_
000
;
return
negative
?
-
nanos
:
nanos
;
return
negative
?
-
nanos
:
nanos
;
}
}
...
@@ -507,13 +507,13 @@ public class DateTimeUtils {
...
@@ -507,13 +507,13 @@ public class DateTimeUtils {
if
(
tz
!=
null
)
{
if
(
tz
!=
null
)
{
if
(
withTimeZone
)
{
if
(
withTimeZone
)
{
if
(
tz
!=
UTC
)
{
if
(
tz
!=
UTC
)
{
long
millis
=
convertDateTimeValueToMillis
(
tz
,
dateValue
,
nanos
/
1
000
000
);
long
millis
=
convertDateTimeValueToMillis
(
tz
,
dateValue
,
nanos
/
1
_000_
000
);
tzMinutes
=
(
short
)
(
tz
.
getOffset
(
millis
)
/
1000
/
60
);
tzMinutes
=
(
short
)
(
tz
.
getOffset
(
millis
)
/
1000
/
60
);
}
}
}
else
{
}
else
{
long
millis
=
convertDateTimeValueToMillis
(
tz
,
dateValue
,
nanos
/
1
000
000
);
long
millis
=
convertDateTimeValueToMillis
(
tz
,
dateValue
,
nanos
/
1
_000_
000
);
dateValue
=
dateValueFromDate
(
millis
);
dateValue
=
dateValueFromDate
(
millis
);
nanos
=
nanos
%
1
000
000
+
nanosFromDate
(
millis
);
nanos
=
nanos
%
1
_000_
000
+
nanosFromDate
(
millis
);
}
}
}
}
}
}
...
@@ -1031,9 +1031,9 @@ public class DateTimeUtils {
...
@@ -1031,9 +1031,9 @@ public class DateTimeUtils {
* @return the time
* @return the time
*/
*/
public
static
Time
convertNanoToTime
(
long
nanosSinceMidnight
)
{
public
static
Time
convertNanoToTime
(
long
nanosSinceMidnight
)
{
long
millis
=
nanosSinceMidnight
/
1
000
000
;
long
millis
=
nanosSinceMidnight
/
1
_000_
000
;
long
s
=
millis
/
1000
;
long
s
=
millis
/
1
_
000
;
millis
-=
s
*
1000
;
millis
-=
s
*
1
_
000
;
long
m
=
s
/
60
;
long
m
=
s
/
60
;
s
-=
m
*
60
;
s
-=
m
*
60
;
long
h
=
m
/
60
;
long
h
=
m
/
60
;
...
@@ -1246,7 +1246,7 @@ public class DateTimeUtils {
...
@@ -1246,7 +1246,7 @@ public class DateTimeUtils {
y
--;
y
--;
m
+=
12
;
m
+=
12
;
}
}
long
a
=
((
y
*
2922L
)
>>
3
)
+
DAYS_OFFSET
[
m
-
3
]
+
d
-
719484
;
long
a
=
((
y
*
2922L
)
>>
3
)
+
DAYS_OFFSET
[
m
-
3
]
+
d
-
719
_
484
;
if
(
y
<=
1582
&&
((
y
<
1582
)
||
(
m
*
100
+
d
<
1015
)))
{
if
(
y
<=
1582
&&
((
y
<
1582
)
||
(
m
*
100
+
d
<
1015
)))
{
// Julian calendar (cutover at 1582-10-04 / 1582-10-15)
// Julian calendar (cutover at 1582-10-04 / 1582-10-15)
a
+=
13
;
a
+=
13
;
...
@@ -1272,7 +1272,7 @@ public class DateTimeUtils {
...
@@ -1272,7 +1272,7 @@ public class DateTimeUtils {
y
--;
y
--;
m
+=
12
;
m
+=
12
;
}
}
long
a
=
((
y
*
2922L
)
>>
3
)
+
DAYS_OFFSET
[
m
-
3
]
+
d
-
719484
;
long
a
=
((
y
*
2922L
)
>>
3
)
+
DAYS_OFFSET
[
m
-
3
]
+
d
-
719
_
484
;
if
(
y
<
1901
||
y
>
2099
)
{
if
(
y
<
1901
||
y
>
2099
)
{
// Slow mode
// Slow mode
a
+=
(
y
/
400
)
-
(
y
/
100
)
+
15
;
a
+=
(
y
/
400
)
-
(
y
/
100
)
+
15
;
...
@@ -1287,19 +1287,19 @@ public class DateTimeUtils {
...
@@ -1287,19 +1287,19 @@ public class DateTimeUtils {
* @return the date value
* @return the date value
*/
*/
public
static
long
dateValueFromAbsoluteDay
(
long
absoluteDay
)
{
public
static
long
dateValueFromAbsoluteDay
(
long
absoluteDay
)
{
long
d
=
absoluteDay
+
719468
;
long
d
=
absoluteDay
+
719
_
468
;
long
y100
=
0
,
offset
;
long
y100
=
0
,
offset
;
if
(
d
>
578040
)
{
if
(
d
>
578
_
040
)
{
// Gregorian calendar
// Gregorian calendar
long
y400
=
d
/
146097
;
long
y400
=
d
/
146
_
097
;
d
-=
y400
*
146097
;
d
-=
y400
*
146
_
097
;
y100
=
d
/
36524
;
y100
=
d
/
36
_
524
;
d
-=
y100
*
36524
;
d
-=
y100
*
36
_
524
;
offset
=
y400
*
400
+
y100
*
100
;
offset
=
y400
*
400
+
y100
*
100
;
}
else
{
}
else
{
// Julian calendar
// Julian calendar
d
+=
292
200000
002L
;
d
+=
292
_200_000_
002L
;
offset
=
-
800
000
000
;
offset
=
-
800
_000_
000
;
}
}
long
y4
=
d
/
1461
;
long
y4
=
d
/
1461
;
d
-=
y4
*
1461
;
d
-=
y4
*
1461
;
...
@@ -1330,7 +1330,7 @@ public class DateTimeUtils {
...
@@ -1330,7 +1330,7 @@ public class DateTimeUtils {
int
y
=
yearFromDateValue
(
dateValue
);
int
y
=
yearFromDateValue
(
dateValue
);
int
m
=
monthFromDateValue
(
dateValue
);
int
m
=
monthFromDateValue
(
dateValue
);
int
d
=
dayFromDateValue
(
dateValue
);
int
d
=
dayFromDateValue
(
dateValue
);
if
(
y
>
0
&&
y
<
10000
)
{
if
(
y
>
0
&&
y
<
10
_
000
)
{
StringUtils
.
appendZeroPadded
(
buff
,
4
,
y
);
StringUtils
.
appendZeroPadded
(
buff
,
4
,
y
);
}
else
{
}
else
{
buff
.
append
(
y
);
buff
.
append
(
y
);
...
@@ -1358,10 +1358,10 @@ public class DateTimeUtils {
...
@@ -1358,10 +1358,10 @@ public class DateTimeUtils {
* get correct result. The simplest way to do this with such constraints is to
* get correct result. The simplest way to do this with such constraints is to
* divide -nanos by -1000000.
* divide -nanos by -1000000.
*/
*/
long
ms
=
-
nanos
/
-
1
000
000
;
long
ms
=
-
nanos
/
-
1
_000_
000
;
nanos
-=
ms
*
1
000
000
;
nanos
-=
ms
*
1
_000_
000
;
long
s
=
ms
/
1000
;
long
s
=
ms
/
1
_
000
;
ms
-=
s
*
1000
;
ms
-=
s
*
1
_
000
;
long
m
=
s
/
60
;
long
m
=
s
/
60
;
s
-=
m
*
60
;
s
-=
m
*
60
;
long
h
=
m
/
60
;
long
h
=
m
/
60
;
...
...
h2/src/main/org/h2/util/MathUtils.java
浏览文件 @
2f4fbec0
...
@@ -224,7 +224,7 @@ public class MathUtils {
...
@@ -224,7 +224,7 @@ public class MathUtils {
public
static
int
nextPowerOf2
(
int
x
)
throws
IllegalArgumentException
{
public
static
int
nextPowerOf2
(
int
x
)
throws
IllegalArgumentException
{
if
(
x
==
0
)
{
if
(
x
==
0
)
{
return
1
;
return
1
;
}
else
if
(
x
<
0
||
x
>
0x40000000
)
{
}
else
if
(
x
<
0
||
x
>
0x4000
_
0000
)
{
throw
new
IllegalArgumentException
(
"Argument out of range"
throw
new
IllegalArgumentException
(
"Argument out of range"
+
" [0x0-0x40000000]. Argument was: "
+
x
);
+
" [0x0-0x40000000]. Argument was: "
+
x
);
}
}
...
...
h2/src/main/org/h2/util/ThreadDeadlockDetector.java
浏览文件 @
2f4fbec0
...
@@ -44,7 +44,7 @@ public class ThreadDeadlockDetector {
...
@@ -44,7 +44,7 @@ public class ThreadDeadlockDetector {
public
void
run
()
{
public
void
run
()
{
checkForDeadlocks
();
checkForDeadlocks
();
}
}
},
10
,
10000
);
},
10
,
10
_
000
);
}
}
/**
/**
...
...
h2/src/main/org/h2/util/ToDateParser.java
浏览文件 @
2f4fbec0
...
@@ -126,8 +126,8 @@ public class ToDateParser {
...
@@ -126,8 +126,8 @@ public class ToDateParser {
if
(
timeZone
==
null
)
{
if
(
timeZone
==
null
)
{
timeZone
=
TimeZone
.
getDefault
();
timeZone
=
TimeZone
.
getDefault
();
}
}
long
millis
=
DateTimeUtils
.
convertDateTimeValueToMillis
(
timeZone
,
dateValue
,
nanos
/
1
000
000
);
long
millis
=
DateTimeUtils
.
convertDateTimeValueToMillis
(
timeZone
,
dateValue
,
nanos
/
1
_000_
000
);
offset
=
(
short
)
(
timeZone
.
getOffset
(
millis
)
/
1000
/
6
0
);
offset
=
(
short
)
(
timeZone
.
getOffset
(
millis
)
/
60_00
0
);
}
}
return
ValueTimestampTimeZone
.
fromDateValueAndNanos
(
dateValue
,
ts
.
getTimeNanos
(),
offset
);
return
ValueTimestampTimeZone
.
fromDateValueAndNanos
(
dateValue
,
ts
.
getTimeNanos
(),
offset
);
}
}
...
...
h2/src/main/org/h2/value/Transfer.java
浏览文件 @
2f4fbec0
...
@@ -372,11 +372,11 @@ public class Transfer {
...
@@ -372,11 +372,11 @@ public class Transfer {
}
else
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_7
)
{
}
else
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_7
)
{
Timestamp
ts
=
v
.
getTimestamp
();
Timestamp
ts
=
v
.
getTimestamp
();
writeLong
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
));
writeLong
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
));
writeInt
(
ts
.
getNanos
()
%
1
000
000
);
writeInt
(
ts
.
getNanos
()
%
1
_000_
000
);
}
else
{
}
else
{
Timestamp
ts
=
v
.
getTimestamp
();
Timestamp
ts
=
v
.
getTimestamp
();
writeLong
(
ts
.
getTime
());
writeLong
(
ts
.
getTime
());
writeInt
(
ts
.
getNanos
()
%
1
000
000
);
writeInt
(
ts
.
getNanos
()
%
1
_000_
000
);
}
}
break
;
break
;
}
}
...
@@ -573,10 +573,10 @@ public class Transfer {
...
@@ -573,10 +573,10 @@ public class Transfer {
}
else
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_7
)
{
}
else
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_7
)
{
return
ValueTimestamp
.
fromMillisNanos
(
return
ValueTimestamp
.
fromMillisNanos
(
DateTimeUtils
.
getTimeUTCWithoutDst
(
readLong
()),
DateTimeUtils
.
getTimeUTCWithoutDst
(
readLong
()),
readInt
()
%
1
000
000
);
readInt
()
%
1
_000_
000
);
}
}
return
ValueTimestamp
.
fromMillisNanos
(
readLong
(),
return
ValueTimestamp
.
fromMillisNanos
(
readLong
(),
readInt
()
%
1
000
000
);
readInt
()
%
1
_000_
000
);
}
}
case
Value
.
TIMESTAMP_TZ
:
{
case
Value
.
TIMESTAMP_TZ
:
{
return
ValueTimestampTimeZone
.
fromDateValueAndNanos
(
readLong
(),
return
ValueTimestampTimeZone
.
fromDateValueAndNanos
(
readLong
(),
...
...
h2/src/main/org/h2/value/ValueDecimal.java
浏览文件 @
2f4fbec0
...
@@ -48,7 +48,7 @@ public class ValueDecimal extends Value {
...
@@ -48,7 +48,7 @@ public class ValueDecimal extends Value {
/**
/**
* The maximum scale of a BigDecimal value.
* The maximum scale of a BigDecimal value.
*/
*/
private
static
final
int
BIG_DECIMAL_SCALE_MAX
=
100000
;
private
static
final
int
BIG_DECIMAL_SCALE_MAX
=
100
_
000
;
private
final
BigDecimal
value
;
private
final
BigDecimal
value
;
private
String
valueString
;
private
String
valueString
;
...
...
h2/src/main/org/h2/value/ValueTime.java
浏览文件 @
2f4fbec0
...
@@ -70,7 +70,7 @@ public class ValueTime extends Value {
...
@@ -70,7 +70,7 @@ public class ValueTime extends Value {
*/
*/
public
static
ValueTime
fromNanos
(
long
nanos
)
{
public
static
ValueTime
fromNanos
(
long
nanos
)
{
if
(!
SysProperties
.
UNLIMITED_TIME_RANGE
)
{
if
(!
SysProperties
.
UNLIMITED_TIME_RANGE
)
{
if
(
nanos
<
0L
||
nanos
>=
86400000000000L
)
{
if
(
nanos
<
0L
||
nanos
>=
DateTimeUtils
.
NANOS_PER_DAY
)
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
DateTimeUtils
.
appendTime
(
builder
,
nanos
);
DateTimeUtils
.
appendTime
(
builder
,
nanos
);
throw
DbException
.
get
(
ErrorCode
.
INVALID_DATETIME_CONSTANT_2
,
throw
DbException
.
get
(
ErrorCode
.
INVALID_DATETIME_CONSTANT_2
,
...
...
h2/src/main/org/h2/value/ValueTimestamp.java
浏览文件 @
2f4fbec0
...
@@ -88,7 +88,7 @@ public class ValueTimestamp extends Value {
...
@@ -88,7 +88,7 @@ public class ValueTimestamp extends Value {
*/
*/
public
static
ValueTimestamp
get
(
Timestamp
timestamp
)
{
public
static
ValueTimestamp
get
(
Timestamp
timestamp
)
{
long
ms
=
timestamp
.
getTime
();
long
ms
=
timestamp
.
getTime
();
long
nanos
=
timestamp
.
getNanos
()
%
1
000
000
;
long
nanos
=
timestamp
.
getNanos
()
%
1
_000_
000
;
long
dateValue
=
DateTimeUtils
.
dateValueFromDate
(
ms
);
long
dateValue
=
DateTimeUtils
.
dateValueFromDate
(
ms
);
nanos
+=
DateTimeUtils
.
nanosFromDate
(
ms
);
nanos
+=
DateTimeUtils
.
nanosFromDate
(
ms
);
return
fromDateValueAndNanos
(
dateValue
,
nanos
);
return
fromDateValueAndNanos
(
dateValue
,
nanos
);
...
...
h2/src/main/org/h2/value/ValueUuid.java
浏览文件 @
2f4fbec0
...
@@ -54,7 +54,7 @@ public class ValueUuid extends Value {
...
@@ -54,7 +54,7 @@ public class ValueUuid extends Value {
// version 4 (random)
// version 4 (random)
high
=
(
high
&
(~
0xf000
L
))
|
0x4000
L
;
high
=
(
high
&
(~
0xf000
L
))
|
0x4000
L
;
// variant (Leach-Salz)
// variant (Leach-Salz)
low
=
(
low
&
0x3fff
ffffffffffff
L
)
|
0x800000000000
0000
L
;
low
=
(
low
&
0x3fff
_ffff_ffff_ffff
L
)
|
0x8000_0000_0000_
0000
L
;
return
new
ValueUuid
(
high
,
low
);
return
new
ValueUuid
(
high
,
low
);
}
}
...
...
h2/src/test/org/h2/samples/DirectInsert.java
浏览文件 @
2f4fbec0
...
@@ -30,7 +30,7 @@ public class DirectInsert {
...
@@ -30,7 +30,7 @@ public class DirectInsert {
Class
.
forName
(
"org.h2.Driver"
);
Class
.
forName
(
"org.h2.Driver"
);
DeleteDbFiles
.
execute
(
"~"
,
"test"
,
true
);
DeleteDbFiles
.
execute
(
"~"
,
"test"
,
true
);
String
url
=
"jdbc:h2:~/test"
;
String
url
=
"jdbc:h2:~/test"
;
initialInsert
(
url
,
200000
);
initialInsert
(
url
,
200
_
000
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
createAsSelect
(
url
,
true
);
createAsSelect
(
url
,
true
);
createAsSelect
(
url
,
false
);
createAsSelect
(
url
,
false
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论