Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
159fe23a
提交
159fe23a
authored
2月 22, 2017
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting, code style, Javadocs
上级
524c1ed8
隐藏空白字符变更
内嵌
并排
正在显示
46 个修改的文件
包含
120 行增加
和
83 行删除
+120
-83
JdbcDriverBackwardsCompat.java
h2/src/main/org/h2/JdbcDriverBackwardsCompat.java
+2
-0
TimestampWithTimeZone.java
h2/src/main/org/h2/api/TimestampWithTimeZone.java
+12
-6
CommandRemote.java
h2/src/main/org/h2/command/CommandRemote.java
+2
-1
AlterIndexRename.java
h2/src/main/org/h2/command/ddl/AlterIndexRename.java
+1
-2
DropDatabase.java
h2/src/main/org/h2/command/ddl/DropDatabase.java
+1
-1
AlterSequence.java
h2/src/main/org/h2/command/dml/AlterSequence.java
+1
-2
Explain.java
h2/src/main/org/h2/command/dml/Explain.java
+2
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-2
DbObjectBase.java
h2/src/main/org/h2/engine/DbObjectBase.java
+3
-2
SessionInterface.java
h2/src/main/org/h2/engine/SessionInterface.java
+0
-1
CompareLike.java
h2/src/main/org/h2/expression/CompareLike.java
+8
-4
Comparison.java
h2/src/main/org/h2/expression/Comparison.java
+2
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+1
-1
JdbcCallableStatementBackwardsCompat.java
...ain/org/h2/jdbc/JdbcCallableStatementBackwardsCompat.java
+2
-0
JdbcConnectionBackwardsCompat.java
h2/src/main/org/h2/jdbc/JdbcConnectionBackwardsCompat.java
+2
-0
JdbcDatabaseMetaDataBackwardsCompat.java
...main/org/h2/jdbc/JdbcDatabaseMetaDataBackwardsCompat.java
+2
-0
JdbcResultSetBackwardsCompat.java
h2/src/main/org/h2/jdbc/JdbcResultSetBackwardsCompat.java
+2
-0
JdbcStatementBackwardsCompat.java
h2/src/main/org/h2/jdbc/JdbcStatementBackwardsCompat.java
+2
-0
JdbcConnectionPoolBackwardsCompat.java
.../main/org/h2/jdbcx/JdbcConnectionPoolBackwardsCompat.java
+2
-0
JdbcDataSourceBackwardsCompat.java
h2/src/main/org/h2/jdbcx/JdbcDataSourceBackwardsCompat.java
+2
-0
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+1
-2
Schema.java
h2/src/main/org/h2/schema/Schema.java
+2
-2
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+0
-1
LobStorageBackend.java
h2/src/main/org/h2/store/LobStorageBackend.java
+2
-2
FileBase.java
h2/src/main/org/h2/store/fs/FileBase.java
+12
-16
JoinBatch.java
h2/src/main/org/h2/table/JoinBatch.java
+2
-2
TableType.java
h2/src/main/org/h2/table/TableType.java
+3
-0
Console.java
h2/src/main/org/h2/tools/Console.java
+2
-2
LazyFuture.java
h2/src/main/org/h2/util/LazyFuture.java
+2
-0
Value.java
h2/src/main/org/h2/value/Value.java
+3
-2
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+5
-5
ValueTimestampTimeZone.java
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
+2
-2
DirectInsert.java
h2/src/test/org/h2/samples/DirectInsert.java
+2
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+7
-6
Database.java
h2/src/test/org/h2/test/bench/Database.java
+1
-1
TestCompatibilityOracle.java
h2/src/test/org/h2/test/db/TestCompatibilityOracle.java
+1
-0
TestFullText.java
h2/src/test/org/h2/test/db/TestFullText.java
+2
-2
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+3
-1
TestMultiThread.java
h2/src/test/org/h2/test/db/TestMultiThread.java
+3
-3
TestOutOfMemory.java
h2/src/test/org/h2/test/db/TestOutOfMemory.java
+2
-1
TestCallableStatement.java
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
+1
-1
TestReorderWrites.java
h2/src/test/org/h2/test/poweroff/TestReorderWrites.java
+2
-1
RecoverLobTest.java
h2/src/test/org/h2/test/recover/RecoverLobTest.java
+4
-1
TestBenchmark.java
h2/src/test/org/h2/test/store/TestBenchmark.java
+2
-1
TestValue.java
h2/src/test/org/h2/test/unit/TestValue.java
+3
-1
FilePathReorderWrites.java
h2/src/test/org/h2/test/utils/FilePathReorderWrites.java
+1
-2
没有找到文件。
h2/src/main/org/h2/JdbcDriverBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2;
*/
public
interface
JdbcDriverBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/api/TimestampWithTimeZone.java
浏览文件 @
159fe23a
...
...
@@ -180,19 +180,25 @@ public class TimestampWithTimeZone implements Serializable, Cloneable {
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
if
(
this
==
obj
)
{
return
true
;
if
(
obj
==
null
)
}
if
(
obj
==
null
)
{
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
}
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
TimestampWithTimeZone
other
=
(
TimestampWithTimeZone
)
obj
;
if
(
dateValue
!=
other
.
dateValue
)
if
(
dateValue
!=
other
.
dateValue
)
{
return
false
;
if
(
timeNanos
!=
other
.
timeNanos
)
}
if
(
timeNanos
!=
other
.
timeNanos
)
{
return
false
;
if
(
timeZoneOffsetMins
!=
other
.
timeZoneOffsetMins
)
}
if
(
timeZoneOffsetMins
!=
other
.
timeZoneOffsetMins
)
{
return
false
;
}
return
true
;
}
...
...
h2/src/main/org/h2/command/CommandRemote.java
浏览文件 @
159fe23a
...
...
@@ -226,8 +226,9 @@ public class CommandRemote implements CommandInterface {
for
(
ParameterInterface
p
:
parameters
)
{
Value
pVal
=
p
.
getParamValue
();
if
(
pVal
==
null
&&
cmdType
==
EXPLAIN
)
if
(
pVal
==
null
&&
cmdType
==
EXPLAIN
)
{
pVal
=
ValueNull
.
INSTANCE
;
}
transfer
.
writeValue
(
pVal
);
}
...
...
h2/src/main/org/h2/command/ddl/AlterIndexRename.java
浏览文件 @
159fe23a
...
...
@@ -55,9 +55,8 @@ public class AlterIndexRename extends DefineCommand {
if
(!
ifExists
)
{
throw
DbException
.
get
(
ErrorCode
.
INDEX_NOT_FOUND_1
,
newIndexName
);
}
else
{
return
0
;
}
return
0
;
}
if
(
oldSchema
.
findIndex
(
session
,
newIndexName
)
!=
null
||
newIndexName
.
equals
(
oldIndexName
))
{
...
...
h2/src/main/org/h2/command/ddl/DropDatabase.java
浏览文件 @
159fe23a
...
...
@@ -104,7 +104,7 @@ public class DropDatabase extends DefineCommand {
// ignore these. the ones we want to drop will get dropped when we drop
// their associated tables, and we will ignore the problematic ones
// that belong to session-local temp tables.
if
(!((
Sequence
)
obj
).
getBelongsToTable
())
{
if
(!((
Sequence
)
obj
).
getBelongsToTable
())
{
list
.
add
(
obj
);
}
}
...
...
h2/src/main/org/h2/command/dml/AlterSequence.java
浏览文件 @
159fe23a
...
...
@@ -92,9 +92,8 @@ public class AlterSequence extends SchemaCommand {
if
(
sequence
==
null
)
{
if
(!
ifExists
)
{
throw
DbException
.
get
(
ErrorCode
.
SEQUENCE_NOT_FOUND_1
,
sequenceName
);
}
else
{
return
0
;
}
return
0
;
}
}
if
(
table
!=
null
)
{
...
...
h2/src/main/org/h2/command/dml/Explain.java
浏览文件 @
159fe23a
...
...
@@ -61,8 +61,9 @@ public class Explain extends Prepared {
@Override
protected
void
checkParameters
()
{
// Check params only in case of EXPLAIN ANALYZE
if
(
executeCommand
)
if
(
executeCommand
)
{
super
.
checkParameters
();
}
}
@Override
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
159fe23a
...
...
@@ -454,8 +454,7 @@ public class Database implements DataHandler {
}
reconnectLastLock
=
old
;
reconnectChangePending
=
pending
;
reconnectCheckNext
=
System
.
nanoTime
()
+
reconnectCheckDelayNs
;
reconnectCheckNext
=
System
.
nanoTime
()
+
reconnectCheckDelayNs
;
return
true
;
}
catch
(
Exception
e
)
{
trace
.
error
(
e
,
"pending {0}"
,
pending
);
...
...
h2/src/main/org/h2/engine/DbObjectBase.java
浏览文件 @
159fe23a
...
...
@@ -37,6 +37,8 @@ public abstract class DbObjectBase implements DbObject {
private
long
modificationId
;
private
boolean
temporary
;
private
String
invalidateStackTrace
;
/**
* Initialize some attributes of this object.
*
...
...
@@ -126,7 +128,6 @@ public abstract class DbObjectBase implements DbObject {
return
objectName
;
}
private
String
invalidateStackTrace
;
/**
* Set the main attributes to null to make sure the object is no longer
* used.
...
...
@@ -145,7 +146,7 @@ public abstract class DbObjectBase implements DbObject {
new
Throwable
().
printStackTrace
(
pw
);
invalidateStackTrace
=
sw
.
toString
();
}
public
final
boolean
isValid
()
{
return
id
!=
-
1
;
}
...
...
h2/src/main/org/h2/engine/SessionInterface.java
浏览文件 @
159fe23a
...
...
@@ -8,7 +8,6 @@ package org.h2.engine;
import
java.io.Closeable
;
import
java.util.ArrayList
;
import
org.h2.command.CommandInterface
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.Trace
;
import
org.h2.store.DataHandler
;
import
org.h2.value.Value
;
...
...
h2/src/main/org/h2/expression/CompareLike.java
浏览文件 @
159fe23a
...
...
@@ -283,8 +283,10 @@ public class CompareLike extends Condition {
private
static
boolean
containsIgnoreCase
(
String
src
,
String
what
)
{
final
int
length
=
what
.
length
();
if
(
length
==
0
)
return
true
;
// Empty string is contained
if
(
length
==
0
)
{
// Empty string is contained
return
true
;
}
final
char
firstLo
=
Character
.
toLowerCase
(
what
.
charAt
(
0
));
final
char
firstUp
=
Character
.
toUpperCase
(
what
.
charAt
(
0
));
...
...
@@ -292,11 +294,13 @@ public class CompareLike extends Condition {
for
(
int
i
=
src
.
length
()
-
length
;
i
>=
0
;
i
--)
{
// Quick check before calling the more expensive regionMatches() method:
final
char
ch
=
src
.
charAt
(
i
);
if
(
ch
!=
firstLo
&&
ch
!=
firstUp
)
if
(
ch
!=
firstLo
&&
ch
!=
firstUp
)
{
continue
;
}
if
(
src
.
regionMatches
(
true
,
i
,
what
,
0
,
length
))
if
(
src
.
regionMatches
(
true
,
i
,
what
,
0
,
length
))
{
return
true
;
}
}
return
false
;
...
...
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
159fe23a
...
...
@@ -199,8 +199,9 @@ public class Comparison extends Condition {
int
resType
=
Value
.
getHigherOrder
(
colType
,
constType
);
// If not the column values will need to be promoted
// to constant type, but vise versa, then let's do this here once.
if
(
constType
!=
resType
)
if
(
constType
!=
resType
)
{
right
=
ValueExpression
.
get
(
r
.
convertTo
(
resType
));
}
}
else
if
(
right
instanceof
Parameter
)
{
((
Parameter
)
right
).
setColumn
(
((
ExpressionColumn
)
left
).
getColumn
());
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
159fe23a
...
...
@@ -83,7 +83,7 @@ public class Function extends Expression implements FunctionCall {
TRUNCATE
=
27
,
SECURE_RAND
=
28
,
HASH
=
29
,
ENCRYPT
=
30
,
DECRYPT
=
31
,
COMPRESS
=
32
,
EXPAND
=
33
,
ZERO
=
34
,
RANDOM_UUID
=
35
,
COSH
=
36
,
SINH
=
37
,
TANH
=
38
,
LN
=
39
,
BITGET
=
40
;
BITGET
=
40
;
public
static
final
int
ASCII
=
50
,
BIT_LENGTH
=
51
,
CHAR
=
52
,
CHAR_LENGTH
=
53
,
CONCAT
=
54
,
DIFFERENCE
=
55
,
HEXTORAW
=
56
,
...
...
h2/src/main/org/h2/jdbc/JdbcCallableStatementBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2.jdbc;
*/
public
interface
JdbcCallableStatementBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/jdbc/JdbcConnectionBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2.jdbc;
*/
public
interface
JdbcConnectionBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaDataBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2.jdbc;
*/
public
interface
JdbcDatabaseMetaDataBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/jdbc/JdbcResultSetBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2.jdbc;
*/
public
interface
JdbcResultSetBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/jdbc/JdbcStatementBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2.jdbc;
*/
public
interface
JdbcStatementBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/jdbcx/JdbcConnectionPoolBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2.jdbcx;
*/
public
interface
JdbcConnectionPoolBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/jdbcx/JdbcDataSourceBackwardsCompat.java
浏览文件 @
159fe23a
...
...
@@ -11,4 +11,6 @@ package org.h2.jdbcx;
*/
public
interface
JdbcDataSourceBackwardsCompat
{
// compatibility interface
}
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
159fe23a
...
...
@@ -215,7 +215,7 @@ public class MVPrimaryIndex extends BaseIndex {
Value
v
=
map
.
get
(
ValueLong
.
get
(
key
));
if
(
v
==
null
)
{
throw
DbException
.
get
(
ErrorCode
.
ROW_NOT_FOUND_IN_PRIMARY_INDEX
,
getSQL
()
+
": "
+
key
);
getSQL
()
+
": "
+
key
);
}
ValueArray
array
=
(
ValueArray
)
v
;
Row
row
=
session
.
createRow
(
array
.
getList
(),
0
);
...
...
@@ -274,7 +274,6 @@ public class MVPrimaryIndex extends BaseIndex {
}
Value
value
=
map
.
get
(
v
);
Entry
<
Value
,
Value
>
e
=
new
DataUtils
.
MapEntry
<
Value
,
Value
>(
v
,
value
);
@SuppressWarnings
(
"unchecked"
)
List
<
Entry
<
Value
,
Value
>>
list
=
Arrays
.
asList
(
e
);
MVStoreCursor
c
=
new
MVStoreCursor
(
session
,
list
.
iterator
(),
v
);
c
.
next
();
...
...
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
159fe23a
...
...
@@ -606,9 +606,9 @@ public class Schema extends DbObjectBase {
}
}
if
(
data
.
tableEngine
!=
null
)
{
if
(
data
.
tableEngineParams
==
null
)
if
(
data
.
tableEngineParams
==
null
)
{
data
.
tableEngineParams
=
this
.
tableEngineParams
;
}
return
database
.
getTableEngine
(
data
.
tableEngine
).
createTable
(
data
);
}
return
new
RegularTable
(
data
);
...
...
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
159fe23a
...
...
@@ -16,7 +16,6 @@ import java.sql.SQLException;
import
java.util.ArrayList
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.Command
;
import
org.h2.command.CommandInterface
;
import
org.h2.engine.ConnectionInfo
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Engine
;
...
...
h2/src/main/org/h2/store/LobStorageBackend.java
浏览文件 @
159fe23a
...
...
@@ -456,7 +456,7 @@ public class LobStorageBackend implements LobStorageInterface {
try
{
init
();
ValueLobDb
v
=
null
;
if
(!
old
.
isRecoveryReference
())
{
if
(!
old
.
isRecoveryReference
())
{
long
lobId
=
getNextLobId
();
String
sql
=
"INSERT INTO "
+
LOB_MAP
+
"(LOB, SEQ, POS, HASH, BLOCK) "
+
"SELECT ?, SEQ, POS, HASH, BLOCK FROM "
+
LOB_MAP
+
" WHERE LOB = ?"
;
...
...
@@ -476,7 +476,7 @@ public class LobStorageBackend implements LobStorageInterface {
reuse
(
sql
,
prep
);
v
=
ValueLobDb
.
create
(
type
,
database
,
tableId
,
lobId
,
null
,
length
);
}
else
{
}
else
{
//Recovery process, no need to copy LOB using normal infrastructure
v
=
ValueLobDb
.
create
(
type
,
database
,
tableId
,
oldLobId
,
null
,
length
);
}
...
...
h2/src/main/org/h2/store/fs/FileBase.java
浏览文件 @
159fe23a
...
...
@@ -34,27 +34,23 @@ public abstract class FileBase extends FileChannel {
public
abstract
int
write
(
ByteBuffer
src
)
throws
IOException
;
@Override
public
int
read
(
ByteBuffer
dst
,
long
position
)
public
synchronized
int
read
(
ByteBuffer
dst
,
long
position
)
throws
IOException
{
synchronized
(
this
)
{
long
oldPos
=
position
();
position
(
position
);
int
len
=
read
(
dst
);
position
(
oldPos
);
return
len
;
}
long
oldPos
=
position
();
position
(
position
);
int
len
=
read
(
dst
);
position
(
oldPos
);
return
len
;
}
@Override
public
int
write
(
ByteBuffer
src
,
long
position
)
public
synchronized
int
write
(
ByteBuffer
src
,
long
position
)
throws
IOException
{
synchronized
(
this
)
{
long
oldPos
=
position
();
position
(
position
);
int
len
=
write
(
src
);
position
(
oldPos
);
return
len
;
}
long
oldPos
=
position
();
position
(
position
);
int
len
=
write
(
src
);
position
(
oldPos
);
return
len
;
}
@Override
...
...
h2/src/main/org/h2/table/JoinBatch.java
浏览文件 @
159fe23a
...
...
@@ -14,8 +14,8 @@ import java.util.concurrent.Future;
import
org.h2.command.dml.Query
;
import
org.h2.command.dml.Select
;
import
org.h2.command.dml.SelectUnion
;
import
org.h2.index.BaseIndex
;
import
org.h2.index.Cursor
;
import
org.h2.index.Index
;
import
org.h2.index.IndexCursor
;
import
org.h2.index.IndexLookupBatch
;
import
org.h2.index.ViewCursor
;
...
...
@@ -33,7 +33,7 @@ import org.h2.value.ValueLong;
/**
* Support for asynchronous batched index lookups on joins.
*
* @see Index#createLookupBatch(org.h2.table.TableFilter[], int)
* @see
Base
Index#createLookupBatch(org.h2.table.TableFilter[], int)
* @see IndexLookupBatch
* @author Sergi Vladykin
*/
...
...
h2/src/main/org/h2/table/TableType.java
浏览文件 @
159fe23a
...
...
@@ -5,6 +5,9 @@
*/
package
org
.
h2
.
table
;
/**
* The table types.
*/
public
enum
TableType
{
/**
...
...
h2/src/main/org/h2/tools/Console.java
浏览文件 @
159fe23a
...
...
@@ -355,8 +355,8 @@ ShutdownHandler {
}
System
.
gc
();
// Mac OS X: Console tool process did not stop on exit
String
OS
=
System
.
getProperty
(
"os.name"
,
"generic"
).
toLowerCase
(
Locale
.
ENGLISH
);
if
(
OS
.
indexOf
(
"mac"
)
>=
0
)
{
String
os
=
System
.
getProperty
(
"os.name"
,
"generic"
).
toLowerCase
(
Locale
.
ENGLISH
);
if
(
os
.
indexOf
(
"mac"
)
>=
0
)
{
for
(
Thread
t
:
Thread
.
getAllStackTraces
().
keySet
())
{
if
(
t
.
getName
().
startsWith
(
"AWT-"
))
{
t
.
interrupt
();
...
...
h2/src/main/org/h2/util/LazyFuture.java
浏览文件 @
159fe23a
...
...
@@ -15,6 +15,8 @@ import org.h2.message.DbException;
* Single threaded lazy future.
*
* @author Sergi Vladykin
*
* @param <T> the result type
*/
public
abstract
class
LazyFuture
<
T
>
implements
Future
<
T
>
{
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
159fe23a
...
...
@@ -158,9 +158,11 @@ public abstract class Value {
* The value type for string values with a fixed size.
*/
public
static
final
int
GEOMETRY
=
22
;
/**
* 23 was a short-lived experiment "TIMESTAMP UTC" which has been removed.
*/
/**
* The value type for TIMESTAMP WITH TIME ZONE values.
*/
...
...
@@ -866,9 +868,8 @@ public abstract class Value {
java
.
util
.
UUID
uuid
=
(
java
.
util
.
UUID
)
object
;
return
ValueUuid
.
get
(
uuid
.
getMostSignificantBits
(),
uuid
.
getLeastSignificantBits
());
}
else
{
throw
DbException
.
get
(
ErrorCode
.
DATA_CONVERSION_ERROR_1
,
getString
());
}
throw
DbException
.
get
(
ErrorCode
.
DATA_CONVERSION_ERROR_1
,
getString
());
case
TIMESTAMP_TZ:
throw
DbException
.
get
(
ErrorCode
.
DATA_CONVERSION_ERROR_1
,
getString
());
...
...
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
159fe23a
...
...
@@ -54,11 +54,11 @@ public class ValueLobDb extends Value implements Value.ValueClob,
private
final
FileStore
tempFile
;
private
int
tableId
;
private
int
hash
;
//Arbonaut: 13.07.2016
// Fix for recovery tool.
private
boolean
isRecoveryReference
=
false
;
private
boolean
isRecoveryReference
;
private
ValueLobDb
(
int
type
,
DataHandler
handler
,
int
tableId
,
long
lobId
,
byte
[]
hmac
,
long
precision
)
{
...
...
@@ -669,11 +669,11 @@ public class ValueLobDb extends Value implements Value.ValueClob,
return
new
ValueLobDb
(
type
,
small
,
precision
);
}
public
void
setRecoveryReference
(
boolean
isRecoveryReference
)
{
this
.
isRecoveryReference
=
isRecoveryReference
;
}
public
boolean
isRecoveryReference
()
{
return
isRecoveryReference
;
}
...
...
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
浏览文件 @
159fe23a
...
...
@@ -25,8 +25,6 @@ import org.h2.util.StringUtils;
*/
public
class
ValueTimestampTimeZone
extends
Value
{
private
static
final
TimeZone
GMT_TIMEZONE
=
TimeZone
.
getTimeZone
(
"GMT"
);
/**
* The precision in digits.
*/
...
...
@@ -43,6 +41,8 @@ public class ValueTimestampTimeZone extends Value {
*/
static
final
int
DEFAULT_SCALE
=
10
;
private
static
final
TimeZone
GMT_TIMEZONE
=
TimeZone
.
getTimeZone
(
"GMT"
);
/**
* A bit field with bits for the year, month, and day (see DateTimeUtils for
* encoding)
...
...
h2/src/test/org/h2/samples/DirectInsert.java
浏览文件 @
159fe23a
...
...
@@ -70,8 +70,8 @@ public class DirectInsert {
(
optimize
?
"(optimized)"
:
""
));
long
time
=
System
.
nanoTime
();
stat
.
execute
(
"CREATE TABLE TEST2 AS SELECT * FROM TEST"
);
System
.
out
.
printf
(
"%.3f sec.\n"
,
(
double
)(
System
.
nanoTime
()
-
time
)
/
TimeUnit
.
SECONDS
.
toNanos
(
1
));
System
.
out
.
printf
(
"%.3f sec.\n"
,
(
double
)
(
System
.
nanoTime
()
-
time
)
/
TimeUnit
.
SECONDS
.
toNanos
(
1
));
stat
.
execute
(
"INSERT INTO TEST2 SELECT * FROM TEST2"
);
stat
.
close
();
conn
.
close
();
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
159fe23a
...
...
@@ -269,6 +269,11 @@ java org.h2.test.TestAll timer
*/
/**
* Set to true if any of the tests fail. Used to return an error code from the whole program.
*/
static
boolean
atLeastOneTestFailed
;
/**
* Whether the MVStore storage is used.
*/
...
...
@@ -415,11 +420,6 @@ java org.h2.test.TestAll timer
*/
ArrayList
<
TestBase
>
tests
=
New
.
arrayList
();
/**
* Set to true if any of the tests fail. Used to return an error code from the whole program.
*/
static
boolean
atLeastOneTestFailed
;
private
Server
server
;
/**
...
...
@@ -929,12 +929,13 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
// event queue watchdog for tests that get stuck when running in Jenkins CI
final
java
.
util
.
Timer
watchdog
=
new
java
.
util
.
Timer
();
// 5 minutes
watchdog
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
ThreadDeadlockDetector
.
dumpAllThreadsAndLocks
(
"test watchdog timed out"
);
}
},
5
*
60
*
1000
);
// 5 minutes
},
5
*
60
*
1000
);
try
{
test
.
runTest
(
this
);
}
finally
{
...
...
h2/src/test/org/h2/test/bench/Database.java
浏览文件 @
159fe23a
...
...
@@ -196,7 +196,7 @@ class Database {
}
}
else
if
(
url
.
startsWith
(
"jdbc:hsqldb:"
))
{
// HSQLDB: use a WRITE_DELAY of 1 second
try
(
Statement
s
=
newConn
.
createStatement
()){
try
(
Statement
s
=
newConn
.
createStatement
())
{
s
.
execute
(
"SET WRITE_DELAY 1"
);
}
}
...
...
h2/src/test/org/h2/test/db/TestCompatibilityOracle.java
浏览文件 @
159fe23a
...
...
@@ -176,6 +176,7 @@ public class TestCompatibilityOracle extends TestBase {
stat
.
executeQuery
(
"SELECT * FROM A WHERE ID IN ()"
);
fail
();
}
catch
(
SQLException
e
)
{
// expected
}
finally
{
conn
.
close
();
}
...
...
h2/src/test/org/h2/test/db/TestFullText.java
浏览文件 @
159fe23a
...
...
@@ -309,7 +309,7 @@ public class TestFullText extends TestBase {
}
trace
(
"sleeping"
);
Thread
.
sleep
(
1000
);
trace
(
"setting stop to true"
);
for
(
Task
t
:
task
)
{
trace
(
"joining "
+
t
);
...
...
@@ -482,7 +482,7 @@ public class TestFullText extends TestBase {
}
}
println
(
"search "
+
prefix
+
": "
+
TimeUnit
.
NANOSECONDS
.
toMillis
(
System
.
nanoTime
()
-
time
)
+
" count: "
+
count
);
TimeUnit
.
NANOSECONDS
.
toMillis
(
System
.
nanoTime
()
-
time
)
+
" count: "
+
count
);
stat
.
execute
(
"CALL "
+
prefix
+
"_DROP_ALL()"
);
conn
.
close
();
}
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
159fe23a
...
...
@@ -1296,7 +1296,9 @@ public class TestFunctions extends TestBase implements AggregateFunction {
try
{
ToDateParser
.
toDate
(
"1-DEC-0000"
,
"DD-MON-RRRR"
);
fail
(
"Oracle to_date should reject year 0 (ORA-01841)"
);
}
catch
(
Exception
e
)
{
}
}
catch
(
Exception
e
)
{
// expected
}
}
private
void
testToDate
()
throws
ParseException
{
...
...
h2/src/test/org/h2/test/db/TestMultiThread.java
浏览文件 @
159fe23a
...
...
@@ -438,14 +438,14 @@ public class TestMultiThread extends TestBase implements Runnable {
private
void
testConcurrentUpdate
()
throws
Exception
{
deleteDb
(
"lockMode"
);
final
int
OBJ_CNT
=
10000
;
final
int
objectCount
=
10000
;
final
String
url
=
getURL
(
"lockMode;MULTI_THREADED=1;LOCK_TIMEOUT=10000"
,
true
);
final
Connection
conn
=
getConnection
(
url
);
conn
.
createStatement
().
execute
(
"CREATE TABLE IF NOT EXISTS ACCOUNT ( ID NUMBER(18,0) not null PRIMARY KEY, BALANCE NUMBER null)"
);
final
PreparedStatement
mergeAcctStmt
=
conn
.
prepareStatement
(
"MERGE INTO Account(id, balance) key (id) VALUES (?, ?)"
);
for
(
int
i
=
0
;
i
<
OBJ_CNT
;
i
++)
{
for
(
int
i
=
0
;
i
<
objectCount
;
i
++)
{
mergeAcctStmt
.
setLong
(
1
,
i
);
mergeAcctStmt
.
setBigDecimal
(
2
,
BigDecimal
.
ZERO
);
mergeAcctStmt
.
execute
();
...
...
@@ -463,7 +463,7 @@ public class TestMultiThread extends TestBase implements Runnable {
public
Void
call
()
throws
Exception
{
for
(
int
j
=
0
;
j
<
1000
;
j
++)
{
updateAcctStmt
.
setDouble
(
1
,
Math
.
random
());
updateAcctStmt
.
setLong
(
2
,
(
int
)
(
Math
.
random
()
*
OBJ_CNT
));
updateAcctStmt
.
setLong
(
2
,
(
int
)
(
Math
.
random
()
*
objectCount
));
updateAcctStmt
.
execute
();
taskConn
.
commit
();
}
...
...
h2/src/test/org/h2/test/db/TestOutOfMemory.java
浏览文件 @
159fe23a
...
...
@@ -100,7 +100,8 @@ public class TestOutOfMemory extends TestBase {
stat
=
conn
.
createStatement
();
stat
.
execute
(
"select 1"
);
conn
.
close
();
FileUtils
.
delete
(
filename
);
// release the static data this test generates
// release the static data this test generates
FileUtils
.
delete
(
filename
);
}
private
void
testUpdateWhenNearlyOutOfMemory
()
throws
SQLException
{
...
...
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
浏览文件 @
159fe23a
...
...
@@ -468,7 +468,7 @@ public class TestCallableStatement extends TestBase {
getClass
().
getName
()
+
".arrayIdentiy\""
);
for
(
Object
[]
arrayToTest
:
arraysToTest
)
{
Array
sqlInputArray
=
connection
.
createArrayOf
(
"ignored"
,
arrayToTest
);
Array
sqlInputArray
=
connection
.
createArrayOf
(
"ignored"
,
arrayToTest
);
try
{
try
(
CallableStatement
callableStatement
=
connection
.
prepareCall
(
"{call arrayIdentiy(?)}"
))
{
callableStatement
.
setArray
(
1
,
sqlInputArray
);
...
...
h2/src/test/org/h2/test/poweroff/TestReorderWrites.java
浏览文件 @
159fe23a
...
...
@@ -192,7 +192,8 @@ public class TestReorderWrites extends TestBase {
}
assertTrue
(
minSize
<
maxSize
);
assertTrue
(
minWritten
<
maxWritten
);
FileUtils
.
delete
(
fileName
);
// release the static data this test generates
// release the static data this test generates
FileUtils
.
delete
(
fileName
);
}
}
h2/src/test/org/h2/test/recover/RecoverLobTest.java
浏览文件 @
159fe23a
...
...
@@ -7,6 +7,9 @@ import org.h2.test.TestBase;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.tools.Recover
;
/**
* Tests BLOB/CLOB recovery.
*/
public
class
RecoverLobTest
extends
TestBase
{
public
static
void
main
(
String
...
a
)
throws
Exception
{
...
...
@@ -16,7 +19,7 @@ public class RecoverLobTest extends TestBase {
@Override
public
TestBase
init
()
throws
Exception
{
TestBase
tb
=
super
.
init
();
config
.
mvStore
=
false
;
config
.
mvStore
=
false
;
return
tb
;
}
...
...
h2/src/test/org/h2/test/store/TestBenchmark.java
浏览文件 @
159fe23a
...
...
@@ -131,7 +131,8 @@ public class TestBenchmark extends TestBase {
Statement
stat
;
String
url
=
"mvstore"
;
if
(
mvStore
)
{
url
+=
";MV_STORE=TRUE"
;
// ;COMPRESS=TRUE";
// ;COMPRESS=TRUE";
url
+=
";MV_STORE=TRUE"
;
}
url
=
getURL
(
url
,
true
);
...
...
h2/src/test/org/h2/test/unit/TestValue.java
浏览文件 @
159fe23a
...
...
@@ -68,7 +68,9 @@ public class TestValue extends TestBase {
rs
.
addRow
(
new
Object
[]{
null
});
rs
.
next
();
for
(
int
type
=
Value
.
NULL
;
type
<
Value
.
TYPE_COUNT
;
type
++)
{
if
(
type
!=
23
)
{
// a defunct experimental type
if
(
type
==
23
)
{
// a defunct experimental type
}
else
{
Value
v
=
DataType
.
readValue
(
null
,
rs
,
1
,
type
);
assertTrue
(
v
==
ValueNull
.
INSTANCE
);
}
...
...
h2/src/test/org/h2/test/utils/FilePathReorderWrites.java
浏览文件 @
159fe23a
...
...
@@ -283,9 +283,8 @@ class FileReorderWrites extends FileBase {
x
+=
addOperation
(
new
FileWriteOperation
(
id
++,
position
+
len1
,
buf2
));
return
x
;
}
else
{
return
addOperation
(
new
FileWriteOperation
(
id
++,
position
,
src
));
}
return
addOperation
(
new
FileWriteOperation
(
id
++,
position
,
src
));
}
private
void
checkError
()
throws
IOException
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论