Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
86cb1379
提交
86cb1379
authored
1月 10, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
e5e6830b
全部展开
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
305 行增加
和
288 行删除
+305
-288
history.html
h2/src/docsrc/html/history.html
+2
-0
mainWeb.html
h2/src/docsrc/html/mainWeb.html
+119
-119
Script.java
h2/src/main/org/h2/command/dml/Script.java
+36
-30
TransactionCommand.java
h2/src/main/org/h2/command/dml/TransactionCommand.java
+11
-6
Constants.java
h2/src/main/org/h2/engine/Constants.java
+4
-6
ExpressionColumn.java
h2/src/main/org/h2/expression/ExpressionColumn.java
+1
-4
BtreeIndex.java
h2/src/main/org/h2/index/BtreeIndex.java
+2
-1
DiskFile.java
h2/src/main/org/h2/store/DiskFile.java
+1
-1
Recover.java
h2/src/main/org/h2/tools/Recover.java
+1
-1
JdbcUtils.java
h2/src/main/org/h2/util/JdbcUtils.java
+4
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+6
-87
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+5
-3
TestPowerOff.java
h2/src/test/org/h2/test/db/TestPowerOff.java
+46
-0
test.in.txt
h2/src/test/org/h2/test/test.in.txt
+67
-30
没有找到文件。
h2/src/docsrc/html/history.html
浏览文件 @
86cb1379
...
...
@@ -35,6 +35,8 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>
Version 1.0 (Current)
</h3>
<h3>
Version 1.0 / TODO
</h3><ul>
<li>
Fixed a problem where data that was in the log file did not end up in the database (recovery failure) a crash, if an index was deleted previously.
<li>
SCRIPT NODATA now writes the row count for each table (this simplifies comparing databases).
<li>
Selecting a column using the syntax schemaName.tableName.columName did not work in all cases.
<li>
Can now parse timestamps with timezone information (Z or +/-hh:mm) and dates before year 1.
However dates before year 1 are not formatted correctly (this is a Java problem).
...
...
h2/src/docsrc/html/mainWeb.html
浏览文件 @
86cb1379
h2/src/main/org/h2/command/dml/Script.java
浏览文件 @
86cb1379
...
...
@@ -194,7 +194,12 @@ public class Script extends ScriptBase {
}
String
tableType
=
table
.
getTableType
();
add
(
sql
,
false
);
if
(
data
&&
Table
.
TABLE
.
equals
(
tableType
))
{
if
(
Table
.
TABLE
.
equals
(
tableType
))
{
if
(
table
.
canGetRowCount
())
{
String
rowcount
=
"-- "
+
table
.
getRowCount
()
+
" = SELECT COUNT(*) FROM "
+
table
.
getSQL
();
add
(
rowcount
,
false
);
}
if
(
data
)
{
PlanItem
plan
=
table
.
getBestPlanItem
(
session
,
null
);
Index
index
=
plan
.
getIndex
();
Cursor
cursor
=
index
.
find
(
session
,
null
,
null
);
...
...
@@ -234,6 +239,7 @@ public class Script extends ScriptBase {
add
(
s
,
true
);
}
}
}
ObjectArray
indexes
=
table
.
getIndexes
();
for
(
int
j
=
0
;
indexes
!=
null
&&
j
<
indexes
.
size
();
j
++)
{
Index
index
=
(
Index
)
indexes
.
get
(
j
);
...
...
h2/src/main/org/h2/command/dml/TransactionCommand.java
浏览文件 @
86cb1379
...
...
@@ -4,7 +4,10 @@
*/
package
org
.
h2
.
command
.
dml
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.sql.SQLException
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipOutputStream
;
...
...
@@ -127,13 +130,15 @@ public class TransactionCommand extends Prepared {
return
0
;
}
private
void
backupTo
(
String
fileName
)
{
// ZipOutputStream out = new ZipOutputStream("test.zip");
// out.putNextEntry(arg0)
private
void
backupTo
(
String
fileName
)
throws
SQLException
{
// int todoAddSpecialSQLStatement;
// FileOutputStream fileout = new FileOutputStream("test.zip");
// ZipOutputStream out = new ZipOutputStream(fileout);
// out.putNextEntry(new ZipEntry("test.data.db"));
// DiskFile file = session.getDatabase().getDataFile();
//
//
session.getDatabase().getLog().incStopDeleteFiles(true);
//
// TODO Auto-generated method stub
//
//
session.getDatabase().getLog().setStopDeleteFiles(false);
// session.getDatabase().getLog().incStopDeleteFiles(true);
// TODO Auto-generated method stub
// session.getDatabase().getLog().setStopDeleteFiles(false);
//
}
...
...
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
86cb1379
...
...
@@ -48,8 +48,6 @@ package org.h2.engine;
* - TestSystemExit
* - Test with hibernate
* - Scan for viruses
*
* - Send a mail to Google Groups
* - newsletter: prepare, send (always send to BCC!!)
* - http://maven.apache.org/guides/mini/guide-ibiblio-upload.html
*
...
...
@@ -57,8 +55,8 @@ package org.h2.engine;
*/
public
class
Constants
{
public
static
final
int
BUILD_ID
=
3
6
;
private
static
final
String
BUILD
=
"2007-01-
02
"
;
public
static
final
int
BUILD_ID
=
3
8
;
private
static
final
String
BUILD
=
"2007-01-
10
"
;
public
static
final
int
VERSION_MAJOR
=
1
;
public
static
final
int
VERSION_MINOR
=
0
;
...
...
@@ -204,7 +202,7 @@ public class Constants {
public
static
final
String
SCRIPT_SQL
=
"script.sql"
;
// for testing only
public
static
int
CACHE_MIN_RECORDS
=
16
;
public
static
final
int
CACHE_MIN_RECORDS
=
16
;
public
static
final
int
MIN_WRITE_DELAY
=
getIntSetting
(
"h2.minWriteDelay"
,
5
);
...
...
h2/src/main/org/h2/expression/ExpressionColumn.java
浏览文件 @
86cb1379
...
...
@@ -9,7 +9,6 @@ import java.util.HashMap;
import
org.h2.command.Parser
;
import
org.h2.command.dml.Select
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
...
...
@@ -21,7 +20,6 @@ import org.h2.table.Table;
import
org.h2.table.TableFilter
;
import
org.h2.value.Value
;
/**
* @author Thomas
*/
...
...
@@ -60,8 +58,7 @@ public class ExpressionColumn extends Expression {
if
(
tableAlias
!=
null
)
{
sql
=
Parser
.
quoteIdentifier
(
tableAlias
)
+
"."
+
sql
;
}
if
(
schemaName
!=
null
&&
!
schemaName
.
equals
(
Constants
.
SCHEMA_MAIN
))
{
int
todoTempSolution
;
if
(
schemaName
!=
null
)
{
sql
=
Parser
.
quoteIdentifier
(
schemaName
)
+
"."
+
sql
;
}
return
sql
;
...
...
h2/src/main/org/h2/index/BtreeIndex.java
浏览文件 @
86cb1379
...
...
@@ -84,9 +84,10 @@ public class BtreeIndex extends Index implements RecordReader {
private
void
setChanged
(
Session
session
)
throws
SQLException
{
if
(
head
!=
null
&&
!
database
.
getLogIndexChanges
())
{
// maybe there was a checkpoint, need to invalidate the summary in this case too
database
.
invalidateIndexSummary
();
if
(
head
.
getConsistent
())
{
deletePage
(
session
,
head
);
database
.
invalidateIndexSummary
();
head
.
setConsistent
(
false
);
flushHead
(
session
);
}
...
...
h2/src/main/org/h2/store/DiskFile.java
浏览文件 @
86cb1379
...
...
@@ -196,7 +196,7 @@ public class DiskFile implements CacheWriter {
ObjectArray
list
=
database
.
getAllStorages
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Storage
s
=
(
Storage
)
list
.
get
(
i
);
if
(
s
.
getDiskFile
()
==
this
)
{
if
(
s
!=
null
&&
s
.
getDiskFile
()
==
this
)
{
database
.
removeStorage
(
s
.
getId
(),
this
);
}
}
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
86cb1379
...
...
@@ -717,7 +717,7 @@ public class Recover implements DataHandler {
MetaRecord
m
=
(
MetaRecord
)
schema
.
get
(
i
);
writer
.
println
(
m
.
getSQL
()
+
";"
);
}
for
(
Iterator
it
=
tableMap
.
ke
ySet
().
iterator
();
it
.
hasNext
();
)
{
for
(
Iterator
it
=
tableMap
.
entr
ySet
().
iterator
();
it
.
hasNext
();
)
{
Map
.
Entry
entry
=
(
Entry
)
it
.
next
();
Integer
objectId
=
(
Integer
)
entry
.
getKey
();
String
name
=
(
String
)
entry
.
getValue
();
...
...
h2/src/main/org/h2/util/JdbcUtils.java
浏览文件 @
86cb1379
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
util
;
import
java.sql.Connection
;
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
86cb1379
差异被折叠。
点击展开。
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
86cb1379
...
...
@@ -147,7 +147,7 @@ public class TestCases extends TestBase {
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
stat
.
execute
(
"INSERT INTO TEST() VALUES()"
);
}
final
boolean
[]
stopped
=
new
boolea
n
[
1
];
final
SQLException
[]
stopped
=
new
SQLExceptio
n
[
1
];
Thread
t
=
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
try
{
...
...
@@ -157,9 +157,9 @@ public class TestCases extends TestBase {
time
=
System
.
currentTimeMillis
()
-
time
;
TestBase
.
logError
(
"query was too quick; result: "
+
rs
.
getInt
(
1
)
+
" time:"
+
time
,
null
);
}
catch
(
SQLException
e
)
{
stopped
[
0
]
=
e
;
// ok
}
stopped
[
0
]
=
true
;
}
});
t
.
start
();
...
...
@@ -167,8 +167,10 @@ public class TestCases extends TestBase {
long
time
=
System
.
currentTimeMillis
();
conn
.
close
();
t
.
join
(
5000
);
if
(
!
stopped
[
0
]
)
{
if
(
stopped
[
0
]
==
null
)
{
error
(
"query still running"
);
}
else
{
checkNotGeneralException
(
stopped
[
0
]);
}
time
=
System
.
currentTimeMillis
()
-
time
;
if
(
time
>
5000
)
{
...
...
h2/src/test/org/h2/test/db/TestPowerOff.java
浏览文件 @
86cb1379
...
...
@@ -18,6 +18,7 @@ import org.h2.jdbc.JdbcConnection;
import
org.h2.test.TestBase
;
import
org.h2.tools.FileBase
;
import
org.h2.util.FileUtils
;
import
org.h2.util.JdbcUtils
;
public
class
TestPowerOff
extends
TestBase
{
...
...
@@ -36,6 +37,7 @@ public class TestPowerOff extends TestBase {
dir
=
"inmemory:"
;
}
url
=
dir
+
"/"
+
dbName
+
";file_lock=no"
;
testSummaryCrash
();
testCrash
();
testShutdown
();
testNoIndexFile
();
...
...
@@ -43,6 +45,50 @@ public class TestPowerOff extends TestBase {
testPersistentTables
();
}
private
void
testSummaryCrash
()
throws
Exception
{
if
(
config
.
networked
)
{
return
;
}
deleteDb
(
dir
,
dbName
);
Connection
conn
=
getConnection
(
url
);
Statement
stat
=
conn
.
createStatement
();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
stat
.
execute
(
"CREATE TABLE TEST"
+
i
+
"(ID INT PRIMARY KEY, NAME VARCHAR)"
);
for
(
int
j
=
0
;
j
<
10
;
j
++)
{
stat
.
execute
(
"INSERT INTO TEST"
+
i
+
" VALUES("
+
j
+
", 'Hello')"
);
}
}
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
stat
.
execute
(
"DROP TABLE TEST"
+
i
);
}
stat
.
execute
(
"SET WRITE_DELAY 0"
);
stat
.
execute
(
"CHECKPOINT"
);
for
(
int
j
=
0
;
j
<
10
;
j
++)
{
stat
.
execute
(
"INSERT INTO TEST1 VALUES("
+(
10
+
j
)+
", 'World')"
);
}
stat
.
execute
(
"SHUTDOWN IMMEDIATELY"
);
JdbcUtils
.
closeSilently
(
conn
);
conn
=
getConnection
(
url
);
stat
=
conn
.
createStatement
();
for
(
int
i
=
1
;
i
<
10
;
i
+=
2
)
{
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
+
i
+
" ORDER BY ID"
);
for
(
int
j
=
0
;
j
<
10
;
j
++)
{
rs
.
next
();
check
(
rs
.
getInt
(
1
),
j
);
check
(
rs
.
getString
(
2
),
"Hello"
);
}
if
(
i
==
1
)
{
for
(
int
j
=
0
;
j
<
10
;
j
++)
{
rs
.
next
();
check
(
rs
.
getInt
(
1
),
j
+
10
);
check
(
rs
.
getString
(
2
),
"World"
);
}
}
checkFalse
(
rs
.
next
());
}
conn
.
close
();
}
private
void
testCrash
()
throws
Exception
{
if
(
config
.
networked
)
{
return
;
...
...
h2/src/test/org/h2/test/test.in.txt
浏览文件 @
86cb1379
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论