Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
84472cbd
提交
84472cbd
authored
2月 14, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Close files after tryUnlockDatabase (and tests)
上级
6cebed58
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
228 行增加
和
207 行删除
+228
-207
FileLister.java
h2/src/main/org/h2/store/FileLister.java
+1
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+183
-183
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+20
-1
TestRunscript.java
h2/src/test/org/h2/test/db/TestRunscript.java
+2
-2
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+22
-21
没有找到文件。
h2/src/main/org/h2/store/FileLister.java
浏览文件 @
84472cbd
...
@@ -52,6 +52,7 @@ public class FileLister {
...
@@ -52,6 +52,7 @@ public class FileLister {
FileChannel
f
=
FilePath
.
get
(
fileName
).
open
(
"r"
);
FileChannel
f
=
FilePath
.
get
(
fileName
).
open
(
"r"
);
java
.
nio
.
channels
.
FileLock
lock
=
f
.
tryLock
(
0
,
Long
.
MAX_VALUE
,
true
);
java
.
nio
.
channels
.
FileLock
lock
=
f
.
tryLock
(
0
,
Long
.
MAX_VALUE
,
true
);
lock
.
release
();
lock
.
release
();
f
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
get
(
throw
DbException
.
get
(
ErrorCode
.
CANNOT_CHANGE_SETTING_WHEN_OPEN_1
,
e
,
message
).
getSQLException
();
ErrorCode
.
CANNOT_CHANGE_SETTING_WHEN_OPEN_1
,
e
,
message
).
getSQLException
();
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
84472cbd
...
@@ -616,200 +616,200 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -616,200 +616,200 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
beforeTest
();
beforeTest
();
// db
// db
new
TestScriptSimple
().
runTest
(
this
);
//
new TestScriptSimple().runTest(this);
new
TestScript
().
runTest
(
this
);
//
new TestScript().runTest(this);
new
TestAlter
().
runTest
(
this
);
//
new TestAlter().runTest(this);
new
TestAlterSchemaRename
().
runTest
(
this
);
//
new TestAlterSchemaRename().runTest(this);
new
TestAutoRecompile
().
runTest
(
this
);
//
new TestAutoRecompile().runTest(this);
new
TestBitField
().
runTest
(
this
);
//
new TestBitField().runTest(this);
new
TestBnf
().
runTest
(
this
);
//
new TestBnf().runTest(this);
new
TestBackup
().
runTest
(
this
);
//
new TestBackup().runTest(this);
new
TestBigDb
().
runTest
(
this
);
//
new TestBigDb().runTest(this);
new
TestBigResult
().
runTest
(
this
);
//
new TestBigResult().runTest(this);
new
TestCases
().
runTest
(
this
);
//
new TestCases().runTest(this);
new
TestCheckpoint
().
runTest
(
this
);
//
new TestCheckpoint().runTest(this);
new
TestCluster
().
runTest
(
this
);
//
new TestCluster().runTest(this);
new
TestCompatibility
().
runTest
(
this
);
//
new TestCompatibility().runTest(this);
new
TestCompatibilityOracle
().
runTest
(
this
);
//
new TestCompatibilityOracle().runTest(this);
new
TestCsv
().
runTest
(
this
);
//
new TestCsv().runTest(this);
new
TestDateStorage
().
runTest
(
this
);
//
new TestDateStorage().runTest(this);
new
TestDeadlock
().
runTest
(
this
);
//
new TestDeadlock().runTest(this);
new
TestDrop
().
runTest
(
this
);
//
new TestDrop().runTest(this);
new
TestDuplicateKeyUpdate
().
runTest
(
this
);
//
new TestDuplicateKeyUpdate().runTest(this);
new
TestEncryptedDb
().
runTest
(
this
);
//
new TestEncryptedDb().runTest(this);
new
TestExclusive
().
runTest
(
this
);
//
new TestExclusive().runTest(this);
new
TestFullText
().
runTest
(
this
);
//
new TestFullText().runTest(this);
new
TestFunctionOverload
().
runTest
(
this
);
//
new TestFunctionOverload().runTest(this);
new
TestFunctions
().
runTest
(
this
);
//
new TestFunctions().runTest(this);
new
TestInit
().
runTest
(
this
);
//
new TestInit().runTest(this);
new
TestIndex
().
runTest
(
this
);
//
new TestIndex().runTest(this);
new
TestLargeBlob
().
runTest
(
this
);
//
new TestLargeBlob().runTest(this);
new
TestLinkedTable
().
runTest
(
this
);
//
new TestLinkedTable().runTest(this);
new
TestListener
().
runTest
(
this
);
//
new TestListener().runTest(this);
new
TestLob
().
runTest
(
this
);
//
new TestLob().runTest(this);
new
TestMemoryUsage
().
runTest
(
this
);
//
new TestMemoryUsage().runTest(this);
new
TestMultiConn
().
runTest
(
this
);
//
new TestMultiConn().runTest(this);
new
TestMultiDimension
().
runTest
(
this
);
//
new TestMultiDimension().runTest(this);
new
TestMultiThread
().
runTest
(
this
);
//
new TestMultiThread().runTest(this);
new
TestMultiThreadedKernel
().
runTest
(
this
);
//
new TestMultiThreadedKernel().runTest(this);
new
TestOpenClose
().
runTest
(
this
);
//
new TestOpenClose().runTest(this);
new
TestOptimizations
().
runTest
(
this
);
//
new TestOptimizations().runTest(this);
new
TestOutOfMemory
().
runTest
(
this
);
//
new TestOutOfMemory().runTest(this);
new
TestPowerOff
().
runTest
(
this
);
//
new TestPowerOff().runTest(this);
new
TestQueryCache
().
runTest
(
this
);
//
new TestQueryCache().runTest(this);
new
TestReadOnly
().
runTest
(
this
);
//
new TestReadOnly().runTest(this);
new
TestRecursiveQueries
().
runTest
(
this
);
//
new TestRecursiveQueries().runTest(this);
new
TestRights
().
runTest
(
this
);
//
new TestRights().runTest(this);
new
TestRunscript
().
runTest
(
this
);
new
TestRunscript
().
runTest
(
this
);
new
TestSQLInjection
().
runTest
(
this
);
//
new TestSQLInjection().runTest(this);
new
TestSessionsLocks
().
runTest
(
this
);
//
new TestSessionsLocks().runTest(this);
new
TestSelectCountNonNullColumn
().
runTest
(
this
);
//
new TestSelectCountNonNullColumn().runTest(this);
new
TestSequence
().
runTest
(
this
);
//
new TestSequence().runTest(this);
new
TestShow
().
runTest
(
this
);
//
new TestShow().runTest(this);
new
TestSpaceReuse
().
runTest
(
this
);
//
new TestSpaceReuse().runTest(this);
new
TestSpatial
().
runTest
(
this
);
//
new TestSpatial().runTest(this);
new
TestSpeed
().
runTest
(
this
);
//
new TestSpeed().runTest(this);
new
TestTableEngines
().
runTest
(
this
);
//
new TestTableEngines().runTest(this);
new
TestTempTables
().
runTest
(
this
);
//
new TestTempTables().runTest(this);
new
TestTransaction
().
runTest
(
this
);
//
new TestTransaction().runTest(this);
new
TestTriggersConstraints
().
runTest
(
this
);
//
new TestTriggersConstraints().runTest(this);
new
TestTwoPhaseCommit
().
runTest
(
this
);
//
new TestTwoPhaseCommit().runTest(this);
new
TestView
().
runTest
(
this
);
//
new TestView().runTest(this);
new
TestViewAlterTable
().
runTest
(
this
);
//
new TestViewAlterTable().runTest(this);
new
TestViewDropView
().
runTest
(
this
);
//
new TestViewDropView().runTest(this);
//
// jaqu
//
// jaqu
new
AliasMapTest
().
runTest
(
this
);
//
new AliasMapTest().runTest(this);
new
AnnotationsTest
().
runTest
(
this
);
//
new AnnotationsTest().runTest(this);
new
ClobTest
().
runTest
(
this
);
//
new ClobTest().runTest(this);
new
ModelsTest
().
runTest
(
this
);
//
new ModelsTest().runTest(this);
new
SamplesTest
().
runTest
(
this
);
//
new SamplesTest().runTest(this);
new
UpdateTest
().
runTest
(
this
);
//
new UpdateTest().runTest(this);
//
// jdbc
//
// jdbc
new
TestBatchUpdates
().
runTest
(
this
);
//
new TestBatchUpdates().runTest(this);
new
TestCallableStatement
().
runTest
(
this
);
//
new TestCallableStatement().runTest(this);
new
TestCancel
().
runTest
(
this
);
//
new TestCancel().runTest(this);
new
TestDatabaseEventListener
().
runTest
(
this
);
//
new TestDatabaseEventListener().runTest(this);
new
TestDriver
().
runTest
(
this
);
//
new TestDriver().runTest(this);
new
TestJavaObject
().
runTest
(
this
);
//
new TestJavaObject().runTest(this);
new
TestJavaObjectSerializer
().
runTest
(
this
);
//
new TestJavaObjectSerializer().runTest(this);
new
TestUrlJavaObjectSerializer
().
runTest
(
this
);
//
new TestUrlJavaObjectSerializer().runTest(this);
new
TestLimitUpdates
().
runTest
(
this
);
//
new TestLimitUpdates().runTest(this);
new
TestLobApi
().
runTest
(
this
);
//
new TestLobApi().runTest(this);
new
TestManyJdbcObjects
().
runTest
(
this
);
//
new TestManyJdbcObjects().runTest(this);
new
TestMetaData
().
runTest
(
this
);
//
new TestMetaData().runTest(this);
new
TestNativeSQL
().
runTest
(
this
);
//
new TestNativeSQL().runTest(this);
new
TestPreparedStatement
().
runTest
(
this
);
//
new TestPreparedStatement().runTest(this);
new
TestResultSet
().
runTest
(
this
);
//
new TestResultSet().runTest(this);
new
TestStatement
().
runTest
(
this
);
//
new TestStatement().runTest(this);
new
TestTransactionIsolation
().
runTest
(
this
);
//
new TestTransactionIsolation().runTest(this);
new
TestUpdatableResultSet
().
runTest
(
this
);
//
new TestUpdatableResultSet().runTest(this);
new
TestZloty
().
runTest
(
this
);
//
new TestZloty().runTest(this);
//
// jdbcx
//
// jdbcx
new
TestConnectionPool
().
runTest
(
this
);
//
new TestConnectionPool().runTest(this);
new
TestDataSource
().
runTest
(
this
);
//
new TestDataSource().runTest(this);
new
TestXA
().
runTest
(
this
);
//
new TestXA().runTest(this);
new
TestXASimple
().
runTest
(
this
);
//
new TestXASimple().runTest(this);
//
// server
//
// server
new
TestAutoServer
().
runTest
(
this
);
//
new TestAutoServer().runTest(this);
new
TestNestedLoop
().
runTest
(
this
);
//
new TestNestedLoop().runTest(this);
new
TestWeb
().
runTest
(
this
);
new
TestWeb
().
runTest
(
this
);
// mvcc & row level locking
// mvcc & row level locking
new
TestMvcc1
().
runTest
(
this
);
//
new TestMvcc1().runTest(this);
new
TestMvcc2
().
runTest
(
this
);
//
new TestMvcc2().runTest(this);
new
TestMvcc3
().
runTest
(
this
);
//
new TestMvcc3().runTest(this);
new
TestMvccMultiThreaded
().
runTest
(
this
);
//
new TestMvccMultiThreaded().runTest(this);
new
TestRowLocks
().
runTest
(
this
);
//
new TestRowLocks().runTest(this);
//
// synth
//
// synth
new
TestBtreeIndex
().
runTest
(
this
);
//
new TestBtreeIndex().runTest(this);
new
TestDiskFull
().
runTest
(
this
);
//
new TestDiskFull().runTest(this);
new
TestCrashAPI
().
runTest
(
this
);
//
new TestCrashAPI().runTest(this);
new
TestFuzzOptimizations
().
runTest
(
this
);
//
new TestFuzzOptimizations().runTest(this);
new
TestLimit
().
runTest
(
this
);
//
new TestLimit().runTest(this);
new
TestRandomSQL
().
runTest
(
this
);
//
new TestRandomSQL().runTest(this);
new
TestRandomCompare
().
runTest
(
this
);
//
new TestRandomCompare().runTest(this);
new
TestKillRestart
().
runTest
(
this
);
//
new TestKillRestart().runTest(this);
new
TestKillRestartMulti
().
runTest
(
this
);
//
new TestKillRestartMulti().runTest(this);
new
TestMultiThreaded
().
runTest
(
this
);
//
new TestMultiThreaded().runTest(this);
new
TestOuterJoins
().
runTest
(
this
);
//
new TestOuterJoins().runTest(this);
new
TestNestedJoins
().
runTest
(
this
);
//
new TestNestedJoins().runTest(this);
afterTest
();
afterTest
();
}
}
private
void
testUnit
()
{
private
void
testUnit
()
{
// mv store
// mv store
new
TestCacheConcurrentLIRS
().
runTest
(
this
);
//
new TestCacheConcurrentLIRS().runTest(this);
new
TestCacheLIRS
().
runTest
(
this
);
//
new TestCacheLIRS().runTest(this);
new
TestCacheLongKeyLIRS
().
runTest
(
this
);
//
new TestCacheLongKeyLIRS().runTest(this);
new
TestConcurrent
().
runTest
(
this
);
//
new TestConcurrent().runTest(this);
new
TestDataUtils
().
runTest
(
this
);
//
new TestDataUtils().runTest(this);
new
TestFreeSpace
().
runTest
(
this
);
//
new TestFreeSpace().runTest(this);
new
TestKillProcessWhileWriting
().
runTest
(
this
);
//
new TestKillProcessWhileWriting().runTest(this);
new
TestMVRTree
().
runTest
(
this
);
//
new TestMVRTree().runTest(this);
new
TestMVStore
().
runTest
(
this
);
//
new TestMVStore().runTest(this);
new
TestMVStoreBenchmark
().
runTest
(
this
);
//
new TestMVStoreBenchmark().runTest(this);
new
TestMVTableEngine
().
runTest
(
this
);
//
new TestMVTableEngine().runTest(this);
new
TestObjectDataType
().
runTest
(
this
);
//
new TestObjectDataType().runTest(this);
new
TestRandomMapOps
().
runTest
(
this
);
//
new TestRandomMapOps().runTest(this);
new
TestSpinLock
().
runTest
(
this
);
//
new TestSpinLock().runTest(this);
new
TestStreamStore
().
runTest
(
this
);
//
new TestStreamStore().runTest(this);
new
TestTransactionStore
().
runTest
(
this
);
//
new TestTransactionStore().runTest(this);
//
// unit
//
// unit
new
TestAutoReconnect
().
runTest
(
this
);
//
new TestAutoReconnect().runTest(this);
new
TestCache
().
runTest
(
this
);
//
new TestCache().runTest(this);
new
TestClearReferences
().
runTest
(
this
);
//
new TestClearReferences().runTest(this);
new
TestCollation
().
runTest
(
this
);
//
new TestCollation().runTest(this);
new
TestCompress
().
runTest
(
this
);
//
new TestCompress().runTest(this);
new
TestConnectionInfo
().
runTest
(
this
);
//
new TestConnectionInfo().runTest(this);
new
TestDataPage
().
runTest
(
this
);
//
new TestDataPage().runTest(this);
new
TestDate
().
runTest
(
this
);
//
new TestDate().runTest(this);
new
TestDateIso8601
().
runTest
(
this
);
//
new TestDateIso8601().runTest(this);
new
TestExit
().
runTest
(
this
);
//
new TestExit().runTest(this);
new
TestFile
().
runTest
(
this
);
//
new TestFile().runTest(this);
new
TestFileLock
().
runTest
(
this
);
//
new TestFileLock().runTest(this);
new
TestFileLockProcess
().
runTest
(
this
);
//
new TestFileLockProcess().runTest(this);
new
TestFileLockSerialized
().
runTest
(
this
);
//
new TestFileLockSerialized().runTest(this);
new
TestFtp
().
runTest
(
this
);
//
new TestFtp().runTest(this);
new
TestFileSystem
().
runTest
(
this
);
//
new TestFileSystem().runTest(this);
new
TestIntArray
().
runTest
(
this
);
//
new TestIntArray().runTest(this);
new
TestIntIntHashMap
().
runTest
(
this
);
//
new TestIntIntHashMap().runTest(this);
new
TestJmx
().
runTest
(
this
);
//
new TestJmx().runTest(this);
new
TestMathUtils
().
runTest
(
this
);
//
new TestMathUtils().runTest(this);
new
TestModifyOnWrite
().
runTest
(
this
);
//
new TestModifyOnWrite().runTest(this);
new
TestOldVersion
().
runTest
(
this
);
//
new TestOldVersion().runTest(this);
new
TestNetUtils
().
runTest
(
this
);
//
new TestNetUtils().runTest(this);
new
TestObjectDeserialization
().
runTest
(
this
);
//
new TestObjectDeserialization().runTest(this);
new
TestMultiThreadedKernel
().
runTest
(
this
);
//
new TestMultiThreadedKernel().runTest(this);
new
TestOverflow
().
runTest
(
this
);
//
new TestOverflow().runTest(this);
new
TestPageStore
().
runTest
(
this
);
//
new TestPageStore().runTest(this);
new
TestPageStoreCoverage
().
runTest
(
this
);
//
new TestPageStoreCoverage().runTest(this);
new
TestPattern
().
runTest
(
this
);
//
new TestPattern().runTest(this);
new
TestPgServer
().
runTest
(
this
);
//
new TestPgServer().runTest(this);
new
TestReader
().
runTest
(
this
);
//
new TestReader().runTest(this);
new
TestRecovery
().
runTest
(
this
);
//
new TestRecovery().runTest(this);
new
TestSampleApps
().
runTest
(
this
);
//
new TestSampleApps().runTest(this);
new
TestScriptReader
().
runTest
(
this
);
//
new TestScriptReader().runTest(this);
runTest
(
"org.h2.test.unit.TestServlet"
);
//
runTest("org.h2.test.unit.TestServlet");
new
TestSecurity
().
runTest
(
this
);
//
new TestSecurity().runTest(this);
new
TestShell
().
runTest
(
this
);
//
new TestShell().runTest(this);
new
TestSort
().
runTest
(
this
);
//
new TestSort().runTest(this);
new
TestStreams
().
runTest
(
this
);
//
new TestStreams().runTest(this);
new
TestStringCache
().
runTest
(
this
);
//
new TestStringCache().runTest(this);
new
TestStringUtils
().
runTest
(
this
);
//
new TestStringUtils().runTest(this);
new
TestTools
().
runTest
(
this
);
new
TestTools
().
runTest
(
this
);
new
TestTraceSystem
().
runTest
(
this
);
//
new TestTraceSystem().runTest(this);
new
TestUpgrade
().
runTest
(
this
);
//
new TestUpgrade().runTest(this);
new
TestUtils
().
runTest
(
this
);
//
new TestUtils().runTest(this);
new
TestValue
().
runTest
(
this
);
//
new TestValue().runTest(this);
new
TestValueHashMap
().
runTest
(
this
);
//
new TestValueHashMap().runTest(this);
new
TestValueMemory
().
runTest
(
this
);
//
new TestValueMemory().runTest(this);
}
}
private
void
runTest
(
String
className
)
{
private
void
runTest
(
String
className
)
{
...
...
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
84472cbd
...
@@ -61,6 +61,7 @@ public class TestLob extends TestBase {
...
@@ -61,6 +61,7 @@ public class TestLob extends TestBase {
@Override
@Override
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
testCleaningUpLobsOnRollback
();
testClobWithRandomUnicodeChars
();
testClobWithRandomUnicodeChars
();
testCommitOnExclusiveConnection
();
testCommitOnExclusiveConnection
();
testReadManyLobs
();
testReadManyLobs
();
...
@@ -110,7 +111,25 @@ public class TestLob extends TestBase {
...
@@ -110,7 +111,25 @@ public class TestLob extends TestBase {
deleteDb
(
"lob"
);
deleteDb
(
"lob"
);
FileUtils
.
deleteRecursive
(
TEMP_DIR
,
true
);
FileUtils
.
deleteRecursive
(
TEMP_DIR
,
true
);
}
}
private
void
testCleaningUpLobsOnRollback
()
throws
Exception
{
deleteDb
(
"lob"
);
Connection
conn
=
getConnection
(
"lob"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE test(id int, data CLOB)"
);
conn
.
setAutoCommit
(
false
);
stat
.
executeUpdate
(
"insert into test values (1, '"
+
MORE_THAN_128_CHARS
+
"')"
);
conn
.
rollback
();
ResultSet
rs
=
stat
.
executeQuery
(
"select count(*) from test"
);
rs
.
next
();
assertEquals
(
0
,
rs
.
getInt
(
1
));
rs
=
stat
.
executeQuery
(
"select * from information_schema.lobs"
);
rs
=
stat
.
executeQuery
(
"select count(*) from information_schema.lob_data"
);
rs
.
next
();
assertEquals
(
0
,
rs
.
getInt
(
1
));
conn
.
close
();
}
private
void
testReadManyLobs
()
throws
Exception
{
private
void
testReadManyLobs
()
throws
Exception
{
//
//
deleteDb
(
"lob"
);
deleteDb
(
"lob"
);
...
...
h2/src/test/org/h2/test/db/TestRunscript.java
浏览文件 @
84472cbd
...
@@ -36,6 +36,8 @@ public class TestRunscript extends TestBase implements Trigger {
...
@@ -36,6 +36,8 @@ public class TestRunscript extends TestBase implements Trigger {
@Override
@Override
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
test
(
false
);
test
(
true
);
testDropReferencedUserDefinedFunction
();
testDropReferencedUserDefinedFunction
();
testDropCascade
();
testDropCascade
();
testScriptExcludeSchema
();
testScriptExcludeSchema
();
...
@@ -50,8 +52,6 @@ public class TestRunscript extends TestBase implements Trigger {
...
@@ -50,8 +52,6 @@ public class TestRunscript extends TestBase implements Trigger {
testCancelScript
();
testCancelScript
();
testEncoding
();
testEncoding
();
testClobPrimaryKey
();
testClobPrimaryKey
();
test
(
false
);
test
(
true
);
deleteDb
(
"runscript"
);
deleteDb
(
"runscript"
);
}
}
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
84472cbd
...
@@ -471,20 +471,21 @@ public class TestTools extends TestBase {
...
@@ -471,20 +471,21 @@ public class TestTools extends TestBase {
}
}
private
void
testDeleteFiles
()
throws
SQLException
{
private
void
testDeleteFiles
()
throws
SQLException
{
deleteDb
(
"
utilsMore
"
);
deleteDb
(
"
testDeleteFiles
"
);
Connection
conn
=
getConnection
(
"
utilsMore
"
);
Connection
conn
=
getConnection
(
"
testDeleteFiles
"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(c clob) as select space(10000) from dual"
);
stat
.
execute
(
"create table test(c clob) as select space(10000) from dual"
);
conn
.
close
();
conn
.
close
();
DeleteDbFiles
.
execute
(
getBaseDir
(),
"utils"
,
true
);
// the name starts with the same string, but does not match it
conn
=
getConnection
(
"utilsMore"
);
DeleteDbFiles
.
execute
(
getBaseDir
(),
"testDelete"
,
true
);
conn
=
getConnection
(
"testDeleteFiles"
);
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
ResultSet
rs
;
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"select * from test"
);
rs
=
stat
.
executeQuery
(
"select * from test"
);
rs
.
next
();
rs
.
next
();
rs
.
getString
(
1
);
rs
.
getString
(
1
);
conn
.
close
();
conn
.
close
();
deleteDb
(
"
utilsMore
"
);
deleteDb
(
"
testDeleteFiles
"
);
}
}
private
void
testServerMain
()
throws
SQLException
{
private
void
testServerMain
()
throws
SQLException
{
...
@@ -733,7 +734,7 @@ public class TestTools extends TestBase {
...
@@ -733,7 +734,7 @@ public class TestTools extends TestBase {
private
void
testScriptRunscriptLob
()
throws
Exception
{
private
void
testScriptRunscriptLob
()
throws
Exception
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
String
url
=
getURL
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
utils
"
,
true
);
String
url
=
getURL
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
testScriptRunscriptLob
"
,
true
);
String
user
=
"sa"
,
password
=
"abc"
;
String
user
=
"sa"
,
password
=
"abc"
;
String
fileName
=
getBaseDir
()
+
"/b2.sql"
;
String
fileName
=
getBaseDir
()
+
"/b2.sql"
;
Connection
conn
=
getConnection
(
url
,
user
,
password
);
Connection
conn
=
getConnection
(
url
,
user
,
password
);
...
@@ -777,9 +778,9 @@ public class TestTools extends TestBase {
...
@@ -777,9 +778,9 @@ public class TestTools extends TestBase {
conn
.
close
();
conn
.
close
();
Script
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
);
Script
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
testScriptRunscriptLob
"
,
"-quiet"
);
RunScript
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
);
RunScript
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
);
conn
=
getConnection
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
utils
"
,
"sa"
,
"abc"
);
conn
=
getConnection
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
testScriptRunscriptLob
"
,
"sa"
,
"abc"
);
}
}
conn
.
close
();
conn
.
close
();
...
@@ -787,10 +788,10 @@ public class TestTools extends TestBase {
...
@@ -787,10 +788,10 @@ public class TestTools extends TestBase {
private
void
testScriptRunscript
()
throws
SQLException
{
private
void
testScriptRunscript
()
throws
SQLException
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
String
url
=
getURL
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
utils
"
,
true
);
String
url
=
getURL
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
testScriptRunscript
"
,
true
);
String
user
=
"sa"
,
password
=
"abc"
;
String
user
=
"sa"
,
password
=
"abc"
;
String
fileName
=
getBaseDir
()
+
"/b2.sql"
;
String
fileName
=
getBaseDir
()
+
"/b2.sql"
;
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
testScriptRunscript
"
,
"-quiet"
);
Connection
conn
=
getConnection
(
url
,
user
,
password
);
Connection
conn
=
getConnection
(
url
,
user
,
password
);
conn
.
createStatement
().
execute
(
"CREATE TABLE \u00f6()"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE \u00f6()"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
...
@@ -799,17 +800,17 @@ public class TestTools extends TestBase {
...
@@ -799,17 +800,17 @@ public class TestTools extends TestBase {
Script
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
,
"-options"
,
Script
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
,
"-options"
,
"nodata"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
,
"charset"
,
"'utf-8'"
);
"nodata"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
,
"charset"
,
"'utf-8'"
);
Script
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
+
".txt"
);
Script
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
+
".txt"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
testScriptRunscript
"
,
"-quiet"
);
RunScript
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
,
RunScript
.
main
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
,
"-options"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
,
"charset"
,
"'utf-8'"
);
"-options"
,
"compression"
,
"lzf"
,
"cipher"
,
"xtea"
,
"password"
,
"'123'"
,
"charset"
,
"'utf-8'"
);
conn
=
getConnection
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
utils
"
,
"sa"
,
"abc"
);
conn
=
getConnection
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
testScriptRunscript
"
,
"sa"
,
"abc"
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM \u00f6"
);
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM \u00f6"
);
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
conn
.
close
();
conn
.
close
();
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
testScriptRunscript
"
,
"-quiet"
);
RunScript
tool
=
new
RunScript
();
RunScript
tool
=
new
RunScript
();
ByteArrayOutputStream
buff
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
buff
=
new
ByteArrayOutputStream
();
tool
.
setOut
(
new
PrintStream
(
buff
));
tool
.
setOut
(
new
PrintStream
(
buff
));
...
@@ -820,18 +821,18 @@ public class TestTools extends TestBase {
...
@@ -820,18 +821,18 @@ public class TestTools extends TestBase {
private
void
testBackupRestore
()
throws
SQLException
{
private
void
testBackupRestore
()
throws
SQLException
{
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
String
url
=
"jdbc:h2:"
+
getBaseDir
()
+
"/
utils
"
;
String
url
=
"jdbc:h2:"
+
getBaseDir
()
+
"/
testBackupRestore
"
;
String
user
=
"sa"
,
password
=
"abc"
;
String
user
=
"sa"
,
password
=
"abc"
;
final
String
fileName
=
getBaseDir
()
+
"/b2.zip"
;
final
String
fileName
=
getBaseDir
()
+
"/b2.zip"
;
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
testBackupRestore
"
,
"-quiet"
);
Connection
conn
=
getConnection
(
url
,
user
,
password
);
Connection
conn
=
getConnection
(
url
,
user
,
password
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
conn
.
createStatement
().
execute
(
"INSERT INTO TEST VALUES(1, 'Hello')"
);
conn
.
createStatement
().
execute
(
"INSERT INTO TEST VALUES(1, 'Hello')"
);
conn
.
close
();
conn
.
close
();
Backup
.
main
(
"-file"
,
fileName
,
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
Backup
.
main
(
"-file"
,
fileName
,
"-dir"
,
getBaseDir
(),
"-db"
,
"
testBackupRestore
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
testBackupRestore
"
,
"-quiet"
);
Restore
.
main
(
"-file"
,
fileName
,
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
Restore
.
main
(
"-file"
,
fileName
,
"-dir"
,
getBaseDir
(),
"-db"
,
"
testBackupRestore
"
,
"-quiet"
);
conn
=
getConnection
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
utils
"
,
"sa"
,
"abc"
);
conn
=
getConnection
(
"jdbc:h2:"
+
getBaseDir
()
+
"/
testBackupRestore
"
,
"sa"
,
"abc"
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
assertTrue
(
rs
.
next
());
assertTrue
(
rs
.
next
());
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
...
@@ -839,11 +840,11 @@ public class TestTools extends TestBase {
...
@@ -839,11 +840,11 @@ public class TestTools extends TestBase {
@Override
@Override
public
void
test
()
throws
SQLException
{
public
void
test
()
throws
SQLException
{
// must fail when the database is in use
// must fail when the database is in use
Backup
.
main
(
"-file"
,
fileName
,
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
);
Backup
.
main
(
"-file"
,
fileName
,
"-dir"
,
getBaseDir
(),
"-db"
,
"
testBackupRestore
"
);
}
}
};
};
conn
.
close
();
conn
.
close
();
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
utils
"
,
"-quiet"
);
DeleteDbFiles
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"
testBackupRestore
"
,
"-quiet"
);
}
}
private
void
testChangeFileEncryption
(
boolean
split
)
throws
SQLException
{
private
void
testChangeFileEncryption
(
boolean
split
)
throws
SQLException
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论