Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a2a2f8ca
提交
a2a2f8ca
authored
7月 03, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
1b68cfa3
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
81 行增加
和
73 行删除
+81
-73
build.html
h2/src/docsrc/html/build.html
+4
-4
history.html
h2/src/docsrc/html/history.html
+10
-8
installation.html
h2/src/docsrc/html/installation.html
+12
-8
quickstartText.html
h2/src/docsrc/html/quickstartText.html
+1
-1
tutorial.html
h2/src/docsrc/html/tutorial.html
+15
-18
Constants.java
h2/src/main/org/h2/engine/Constants.java
+3
-2
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-0
ValueDecimal.java
h2/src/main/org/h2/value/ValueDecimal.java
+2
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+5
-8
TestRecover.java
h2/src/test/org/h2/test/poweroff/TestRecover.java
+27
-23
dictionary.txt
h2/src/tools/org/h2/tools/doc/dictionary.txt
+1
-0
没有找到文件。
h2/src/docsrc/html/build.html
浏览文件 @
a2a2f8ca
...
@@ -24,18 +24,18 @@ Build
...
@@ -24,18 +24,18 @@ Build
<br
/><a
name=
"portability"
></a>
<br
/><a
name=
"portability"
></a>
<h2>
Portability
</h2>
<h2>
Portability
</h2>
This database is written in Java and therefore works on many platforms.
This database is written in Java and therefore works on many platforms.
It
is also possible to compile it to a native executable using GCJ.
It
can also be compiled to a native executable using GCJ.
<br
/><a
name=
"environment"
></a>
<br
/><a
name=
"environment"
></a>
<h2>
Environment
</h2>
<h2>
Environment
</h2>
To build the database executables, the following software stack was used.
To build the database executables, the following software stack was used.
In most cases, newer version or compatible software works too
, but this was not tested
.
In most cases, newer version or compatible software works too.
<ul>
<ul>
<li>
Windows XP
<li>
Windows XP
</li><li>
Sun JDK Version 1.4
</li><li>
Sun JDK Version 1.4
or 1.5
</li><li>
Apache Ant Version 1.6.5
</li><li>
Apache Ant Version 1.6.5
</li><li>
Mozilla Firefox 1.5
</li><li>
Mozilla Firefox 1.5
</li><li>
Eclipse Version 3.2.
1
</li><li>
Eclipse Version 3.2.
2
</li><li>
YourKit Java Profiler
</li><li>
YourKit Java Profiler
</li></ul>
</li></ul>
...
...
h2/src/docsrc/html/history.html
浏览文件 @
a2a2f8ca
...
@@ -37,16 +37,18 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
...
@@ -37,16 +37,18 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>
Version 1.0 (Current)
</h3>
<h3>
Version 1.0 (Current)
</h3>
<h3>
Version 1.0 / TODO (Build TODO)
</h3><ul>
<h3>
Version 1.0 / TODO (Build TODO)
</h3><ul>
<li>
The default database name in the documentation is now jdbc:h2:~/test. Like this, the database
<li>
Now PreparedStatement.setBigDecimal(..) can be called with an object of a derrived class
is stored in the user home directory (system property user.home). Of course storing the database
if the system property h2.allowBigDecimalExtensions is set to true.
in the current working directory (as in jdbc:h2:test) still works. Using the user directory avoids
</li><li>
The default database name in the documentation is now jdbc:h2:~/test. Like this, the database
the problem that the database is not found if the application runs in another directory than
is stored in the user home directory (system property user.home). Of course storing the database
the console.
in the current working directory (as in jdbc:h2:test) still works. Using the user directory avoids
the problem that the database is not found if the application runs in another directory than
the console.
</li><li>
The SQL statement SET ASSERT has been deprecated, because Constants.CHECK is now final.
</li><li>
The SQL statement SET ASSERT has been deprecated, because Constants.CHECK is now final.
To disable assertions (and improve performance), the system property h2.check can be used.
To disable assertions (and improve performance), the system property h2.check can be used.
Executing SET ASSERT still works, but has no effect.
Executing SET ASSERT still works, but has no effect.
</li><li>
In the READ_COMMITTED mode, when the multi-threaded kernel is enabled,
</li><li>
In the READ_COMMITTED mode, when the multi-threaded kernel is enabled,
read locks are now acquired but released immediately after a query.
read locks are now acquired but released immediately after a query.
</li><li>
The default trace level for JdbcDataSourceFactory was DEBUG, so when using data sources a trace file
</li><li>
The default trace level for JdbcDataSourceFactory was DEBUG, so when using data sources a trace file
was always created. Now the default trace level is ERROR, and the file is only created if necessary.
was always created. Now the default trace level is ERROR, and the file is only created if necessary.
</li><li>
PooledConnection.getConnection took a long time if only one connection was open at any time. Fixed.
</li><li>
PooledConnection.getConnection took a long time if only one connection was open at any time. Fixed.
...
...
h2/src/docsrc/html/installation.html
浏览文件 @
a2a2f8ca
...
@@ -23,20 +23,20 @@ Installation
...
@@ -23,20 +23,20 @@ Installation
<br
/><a
name=
"requirements"
></a>
<br
/><a
name=
"requirements"
></a>
<h2>
Requirements
</h2>
<h2>
Requirements
</h2>
To run the database, the following software stack is known to work.
To run the database, the following minimum software stack is known to work:
Compatible software works too, but this was not tested.
<ul>
<ul>
<li>
Windows XP
<li>
Windows XP, MacOS, or Linux
</li><li>
Sun JDK Version 1.4
</li><li>
Recommended Windows file system: NTFS (FAT32 supports files up to 4 GB)
</li><li>
Mozilla Firefox 1.5
</li><li>
Sun JDK 1.4 or newer
</li><li>
Mozilla Firefox 1.5 or newer
</li></ul>
</li></ul>
<br
/><a
name=
"supported_platforms"
></a>
<br
/><a
name=
"supported_platforms"
></a>
<h2>
Supported Platforms
</h2>
<h2>
Supported Platforms
</h2>
As this database is written in Java, it can be run on many different platforms.
As this database is written in Java, it can be run on many different platforms.
It is tested with Java 1.4
and 1.5,
but can also be compiled to native code using GCJ.
It is tested with Java 1.4
, 1.5, and 1.6
but can also be compiled to native code using GCJ.
The source code does not use features of Java 1.5. Currently, the database is
The source code does not use features of Java 1.5. Currently, the database is
developed and tested on Windows XP using the Sun JDK
s, but probably
it also
developed and tested on Windows XP using the Sun JDK
1.4, but
it also
works in many other operating systems and using other Java runtime environments.
works in many other operating systems and using other Java runtime environments.
<br
/><a
name=
"installing"
></a>
<br
/><a
name=
"installing"
></a>
...
@@ -55,7 +55,7 @@ After installing, you should get the following directory structure:
...
@@ -55,7 +55,7 @@ After installing, you should get the following directory structure:
</tr>
</tr>
<tr>
<tr>
<td>
bin
</td>
<td>
bin
</td>
<td>
Executables and JAR
files
</td>
<td>
JAR and batch
files
</td>
</tr>
</tr>
<tr>
<tr>
<td>
docs
</td>
<td>
docs
</td>
...
@@ -73,6 +73,10 @@ After installing, you should get the following directory structure:
...
@@ -73,6 +73,10 @@ After installing, you should get the following directory structure:
<td>
odbc
</td>
<td>
odbc
</td>
<td>
ODBC drivers and tools
</td>
<td>
ODBC drivers and tools
</td>
</tr>
</tr>
<tr>
<td>
service
</td>
<td>
Tools to run the database as a Windows Serivce
</td>
</tr>
<tr>
<tr>
<td>
src
</td>
<td>
src
</td>
<td>
Source files
</td>
<td>
Source files
</td>
...
...
h2/src/docsrc/html/quickstartText.html
浏览文件 @
a2a2f8ca
...
@@ -33,7 +33,7 @@ Click <span class="button">Start</span>,
...
@@ -33,7 +33,7 @@ Click <span class="button">Start</span>,
<img
class=
"screenshot"
src=
"quickstart-1.png"
alt=
"screenshot: start H2 Console"
/><br
/>
<img
class=
"screenshot"
src=
"quickstart-1.png"
alt=
"screenshot: start H2 Console"
/><br
/>
A new console window appears:
<br
/>
A new console window appears:
<br
/>
<img
class=
"screenshot"
src=
"quickstart-2.png"
alt=
"screenshot: H2 Running"
/><br
/>
<img
class=
"screenshot"
src=
"quickstart-2.png"
alt=
"screenshot: H2 Running"
/><br
/>
Also, a new browser page should open with URL
<a
href=
"http://localhost:8082"
target=
"_blank"
>
http://localhost:8082
</a>
.
Also, a new browser page should open with
the
URL
<a
href=
"http://localhost:8082"
target=
"_blank"
>
http://localhost:8082
</a>
.
You may get a security warning from the firewall. If you don't want other computers in the network to access the database
You may get a security warning from the firewall. If you don't want other computers in the network to access the database
on your machine, you can let the firewall block these connections. Only local connections are required at this time.
on your machine, you can let the firewall block these connections. Only local connections are required at this time.
...
...
h2/src/docsrc/html/tutorial.html
浏览文件 @
a2a2f8ca
...
@@ -38,39 +38,37 @@ This can be a H2 database, or another database that supports the JDBC API.
...
@@ -38,39 +38,37 @@ This can be a H2 database, or another database that supports the JDBC API.
</p>
</p>
<img
src=
"console.png"
alt=
"Web Browser - H2 Console Server - H2 Database"
/>
<img
src=
"console.png"
alt=
"Web Browser - H2 Console Server - H2 Database"
/>
<p>
<p>
This is a client / server application, so both a server and a client are required to run it.
This is a client / server application, so both a server and a client
(a browser)
are required to run it.
</p><p>
</p><p>
Depending on your platform and environment, there are multiple ways to start the application:
Depending on your platform and environment, there are multiple ways to start the application:
</p>
</p>
<table><tr><th>
OS
</th><th>
Java
</th><th>
Start
</th></tr>
<table><tr><th>
OS
</th><th>
Start
</th></tr>
<tr>
<tr>
<td>
Windows
</td>
<td>
Windows
</td>
<td>
1.4 or 1.5
</td>
<td>
<td>
Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]
<br
/>
Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]
<br
/>
If this worked correctly, an icon will be added to the system tray:
When using the Sun JDK 1.4 or 1.5, a window with the title 'H2 Console ' should appear.
When using the Sun JDK 1.6, an icon will be added to the system tray:
<img
src=
"h2.png"
alt=
"[H2 icon]"
/><br
/>
<img
src=
"h2.png"
alt=
"[H2 icon]"
/><br
/>
If you don't get the system tray icon, then maybe Java is not installed correctly (in this case, try another way to start the application).
If you don't get the window and the system tray icon,
then maybe Java is not installed correctly (in this case, try another way to start the application).
A browser window should open
A browser window should open
and point to the Login page (URL:
<a
href=
"http://localhost:8082"
target=
"_blank"
>
http://localhost:8082
</a>
).
and point to the Login page (URL:
<a
href=
"http://localhost:8082"
target=
"_blank"
>
http://localhost:8082
</a>
).
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td>
Windows
</td>
<td>
Windows
</td>
<td>
1.4 or 1.5
</td>
<td>
<td>
Open a file browser, navigate to h2/bin, and double click on h2.bat.
<br
/>
Open a file browser, navigate to h2/bin, and double click on h2.bat.
<br
/>
If this worked correctly, an icon will be added to the system tray.
A console window appears. If there is a problem, you will see an error message
If there is a problem, you will see the error message on the console window.
in this window. A browser window will open and point to the Login page
A browser window will open
(URL:
<a
href=
"http://localhost:8082"
target=
"_blank"
>
http://localhost:8082
</a>
).
and point to the Login page (URL:
<a
href=
"http://localhost:8082"
target=
"_blank"
>
http://localhost:8082
</a>
).
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td>
Any
</td>
<td>
Any
</td>
<td>
1.4 or 1.5
</td>
<td>
<td>
Open a console window, navigate to the directory 'h2/
lib
' and type:
Open a console window, navigate to the directory 'h2/
bin
' and type:
<pre>
<pre>
java -cp h2.jar org.h2.tools.Server
java -cp h2.jar org.h2.tools.Server
</pre>
</pre>
...
@@ -81,14 +79,13 @@ java -cp h2.jar org.h2.tools.Server
...
@@ -81,14 +79,13 @@ java -cp h2.jar org.h2.tools.Server
<h3>
Firewall
</h3>
<h3>
Firewall
</h3>
<p>
<p>
If you start the server, you may get a security warning from the firewall (if you have installed one).
If you start the server, you may get a security warning from the firewall (if you have installed one).
If you don't want other computers in the network to access the
database
on your machine, you can
If you don't want other computers in the network to access the
application
on your machine, you can
let the firewall block those connections. The connection from the local machine will still work.
let the firewall block those connections. The connection from the local machine will still work.
Only if you want other computers to access the database on this computer, you need allow remote connections
Only if you want other computers to access the database on this computer, you need allow remote connections
in the firewall.
in the firewall.
</p><p>
</p><p>
Please not that a small firewall is already built into the server. This mechanism by default does not
A small firewall is already built into the server: other computers may not connect to the server by default.
allow other computer to connect to the server. This can be changed in the Preferences
To change this, go to 'Preferences' and select 'Allow connections from other computers'.
(Allow connections from other computers).
</p>
</p>
<h3>
Native Version
</h3>
<h3>
Native Version
</h3>
...
...
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
a2a2f8ca
...
@@ -69,8 +69,8 @@ import org.h2.message.TraceSystem;
...
@@ -69,8 +69,8 @@ import org.h2.message.TraceSystem;
*/
*/
public
class
Constants
{
public
class
Constants
{
public
static
final
int
BUILD_ID
=
5
2
;
public
static
final
int
BUILD_ID
=
5
3
;
private
static
final
String
BUILD
=
"2007-0
6-30
"
;
private
static
final
String
BUILD
=
"2007-0
7-03
"
;
public
static
final
int
VERSION_MAJOR
=
1
;
public
static
final
int
VERSION_MAJOR
=
1
;
public
static
final
int
VERSION_MINOR
=
0
;
public
static
final
int
VERSION_MINOR
=
0
;
...
@@ -248,6 +248,7 @@ public class Constants {
...
@@ -248,6 +248,7 @@ public class Constants {
public
static
int
MAX_FILE_RETRY
=
Math
.
max
(
1
,
getIntSetting
(
"h2.maxFileRetry"
,
16
));
public
static
int
MAX_FILE_RETRY
=
Math
.
max
(
1
,
getIntSetting
(
"h2.maxFileRetry"
,
16
));
public
static
boolean
LOB_CLOSE_BETWEEN_READS
=
getBooleanSetting
(
"h2.lobCloseBetweenReads"
,
false
);
public
static
boolean
LOB_CLOSE_BETWEEN_READS
=
getBooleanSetting
(
"h2.lobCloseBetweenReads"
,
false
);
public
static
boolean
INDEX_OLD
=
getBooleanSetting
(
"h2.indexOld"
,
false
);
public
static
boolean
INDEX_OLD
=
getBooleanSetting
(
"h2.indexOld"
,
false
);
public
static
final
boolean
ALLOW_BIG_DECIMAL_EXTENSIONS
=
getBooleanSetting
(
"h2.allowBigDecimalExtensions"
,
false
);
public
static
final
boolean
INDEX_LOOKUP_NEW
=
getBooleanSetting
(
"h2.indexLookupNew"
,
true
);
public
static
final
boolean
INDEX_LOOKUP_NEW
=
getBooleanSetting
(
"h2.indexLookupNew"
,
true
);
public
static
final
boolean
TRACE_IO
=
getBooleanSetting
(
"h2.traceIO"
,
false
);
public
static
final
boolean
TRACE_IO
=
getBooleanSetting
(
"h2.traceIO"
,
false
);
public
static
final
int
DATASOURCE_TRACE_LEVEL
=
getIntSetting
(
"h2.dataSourceTraceLevel"
,
TraceSystem
.
ERROR
);
public
static
final
int
DATASOURCE_TRACE_LEVEL
=
getIntSetting
(
"h2.dataSourceTraceLevel"
,
TraceSystem
.
ERROR
);
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
a2a2f8ca
...
@@ -699,6 +699,7 @@ public class MetaTable extends Table {
...
@@ -699,6 +699,7 @@ public class MetaTable extends Table {
add
(
rows
,
new
String
[]{
"h2.scriptDirectory"
,
Constants
.
SCRIPT_DIRECTORY
});
add
(
rows
,
new
String
[]{
"h2.scriptDirectory"
,
Constants
.
SCRIPT_DIRECTORY
});
add
(
rows
,
new
String
[]{
"h2.maxFileRetry"
,
""
+
Constants
.
MAX_FILE_RETRY
});
add
(
rows
,
new
String
[]{
"h2.maxFileRetry"
,
""
+
Constants
.
MAX_FILE_RETRY
});
add
(
rows
,
new
String
[]{
"h2.lobCloseBetweenReads"
,
""
+
Constants
.
LOB_CLOSE_BETWEEN_READS
});
add
(
rows
,
new
String
[]{
"h2.lobCloseBetweenReads"
,
""
+
Constants
.
LOB_CLOSE_BETWEEN_READS
});
add
(
rows
,
new
String
[]{
"h2.allowBigDecimalExtensions"
,
""
+
Constants
.
ALLOW_BIG_DECIMAL_EXTENSIONS
});
break
;
break
;
}
}
case
TYPE_INFO:
{
case
TYPE_INFO:
{
...
...
h2/src/main/org/h2/value/ValueDecimal.java
浏览文件 @
a2a2f8ca
...
@@ -8,6 +8,7 @@ import java.math.BigDecimal;
...
@@ -8,6 +8,7 @@ import java.math.BigDecimal;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
org.h2.engine.Constants
;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
...
@@ -32,7 +33,7 @@ public class ValueDecimal extends Value {
...
@@ -32,7 +33,7 @@ public class ValueDecimal extends Value {
private
ValueDecimal
(
BigDecimal
value
)
{
private
ValueDecimal
(
BigDecimal
value
)
{
if
(
value
==
null
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
throw
new
NullPointerException
();
}
else
if
(!
value
.
getClass
().
equals
(
BigDecimal
.
class
))
{
}
else
if
(!
Constants
.
ALLOW_BIG_DECIMAL_EXTENSIONS
&&
!
value
.
getClass
().
equals
(
BigDecimal
.
class
))
{
SQLException
e
=
Message
.
getSQLException
(
Message
.
INVALID_CLASS_2
,
new
String
[]{
BigDecimal
.
class
.
getName
(),
value
.
getClass
().
getName
()},
null
);
SQLException
e
=
Message
.
getSQLException
(
Message
.
INVALID_CLASS_2
,
new
String
[]{
BigDecimal
.
class
.
getName
(),
value
.
getClass
().
getName
()},
null
);
throw
Message
.
convertToInternal
(
e
);
throw
Message
.
convertToInternal
(
e
);
}
}
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
a2a2f8ca
...
@@ -7,7 +7,6 @@ package org.h2.test;
...
@@ -7,7 +7,6 @@ package org.h2.test;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.Properties
;
import
java.util.Properties
;
import
org.h2.message.TraceSystem
;
import
org.h2.server.TcpServer
;
import
org.h2.server.TcpServer
;
import
org.h2.test.jdbc.*
;
import
org.h2.test.jdbc.*
;
import
org.h2.test.jdbc.xa.TestXA
;
import
org.h2.test.jdbc.xa.TestXA
;
...
@@ -95,6 +94,8 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
...
@@ -95,6 +94,8 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
/*
/*
maybe another server server already
make sure INDEX_LOOKUP_NEW = is true by default.
make sure INDEX_LOOKUP_NEW = is true by default.
Test Console (batch, javaw, different platforms)
Test Console (batch, javaw, different platforms)
test with openoffice (metadata changes)
test with openoffice (metadata changes)
...
@@ -137,9 +138,6 @@ I will add this to the todo list.
...
@@ -137,9 +138,6 @@ I will add this to the todo list.
Docs: Fix Quickstart
Docs: Fix Quickstart
Dave Brewster (dbrewster at guidewire dot com): currency:
Add a setting to allow BigDecimal extensions
Send SQL Injection solution proposal to PostgreSQL, MySQL, Derby, HSQLDB,...
Send SQL Injection solution proposal to PostgreSQL, MySQL, Derby, HSQLDB,...
Improve LOB in directories performance
Improve LOB in directories performance
...
@@ -148,8 +146,6 @@ Improve documentation for MAX_LENGTH_INPLACE_LOB
...
@@ -148,8 +146,6 @@ Improve documentation for MAX_LENGTH_INPLACE_LOB
Convert SQL-injection-2.txt to html document, include SQLInjection.java sample
Convert SQL-injection-2.txt to html document, include SQLInjection.java sample
Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip
Test Eclipse DTP 1.5 (HSQLDB / H2 connection bug fixed)
Test Eclipse DTP 1.5 (HSQLDB / H2 connection bug fixed)
Automate real power off tests
Automate real power off tests
...
@@ -167,12 +163,13 @@ support translated exceptions (translated, then english at the end, for Hibernat
...
@@ -167,12 +163,13 @@ support translated exceptions (translated, then english at the end, for Hibernat
make static member variables final (this helps find forgotten initializers)
make static member variables final (this helps find forgotten initializers)
Merge more from diff.zip (Pavel Ganelin)
Merge more from diff.zip (Pavel Ganelin)
Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip
inlining
: try to shorten methods that are used very often
performance
: try to shorten methods that are used very often
store dates as 'local'. Problem: existing files use GMT (use escape syntax)
store dates as 'local'. Problem: existing files use GMT (use escape syntax)
drop table test;
drop table test;
CREATE TABLE TEST( ID BIGINT PRIMARY KEY, CREATED
ON
TIMESTAMP);
CREATE TABLE TEST( ID BIGINT PRIMARY KEY, CREATED TIMESTAMP);
INSERT INTO TEST VALUES(1, '2007-01-01 00:00:00');
INSERT INTO TEST VALUES(1, '2007-01-01 00:00:00');
SELECT * FROM TEST;
SELECT * FROM TEST;
...
...
h2/src/test/org/h2/test/poweroff/TestRecover.java
浏览文件 @
a2a2f8ca
/*
* 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
.
test
.
poweroff
;
package
org
.
h2
.
test
.
poweroff
;
import
java.io.File
;
import
java.io.File
;
...
@@ -24,11 +28,11 @@ import java.util.zip.ZipOutputStream;
...
@@ -24,11 +28,11 @@ import java.util.zip.ZipOutputStream;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
public
class
TestRecover
{
public
class
TestRecover
{
private
Random
random
;
private
Random
random
;
private
static
final
String
RELATIVE
=
System
.
getProperty
(
"h2.testRecoverPath"
,
"db
"
);
private
static
final
String
NODE
=
System
.
getProperty
(
"h2.testRecoverPath"
,
"1
"
);
private
static
final
String
TEST_DIRECTORY
=
"/temp/
"
+
RELATIVE
+
"/data"
;
private
static
final
String
TEST_DIRECTORY
=
"/temp/
db/data"
+
NODE
;
private
static
final
String
BACKUP_DIRECTORY
=
"/temp/
"
+
RELATIVE
+
"
/last"
;
private
static
final
String
BACKUP_DIRECTORY
=
"/temp/
db
/last"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
new
TestRecover
().
runTest
(
args
);
new
TestRecover
().
runTest
(
args
);
...
@@ -37,7 +41,7 @@ public class TestRecover {
...
@@ -37,7 +41,7 @@ public class TestRecover {
private
void
runTest
(
String
[]
args
)
throws
Exception
{
private
void
runTest
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"backup..."
);
System
.
out
.
println
(
"backup..."
);
new
File
(
TEST_DIRECTORY
).
mkdirs
();
new
File
(
TEST_DIRECTORY
).
mkdirs
();
File
backup
=
backup
(
TEST_DIRECTORY
,
BACKUP_DIRECTORY
,
"data"
,
10
);
File
backup
=
backup
(
TEST_DIRECTORY
,
BACKUP_DIRECTORY
,
"data"
,
10
,
NODE
);
System
.
out
.
println
(
"check consistency..."
);
System
.
out
.
println
(
"check consistency..."
);
if
(!
testConsistency
())
{
if
(!
testConsistency
())
{
System
.
out
.
println
(
"error! renaming file"
);
System
.
out
.
println
(
"error! renaming file"
);
...
@@ -49,7 +53,7 @@ public class TestRecover {
...
@@ -49,7 +53,7 @@ public class TestRecover {
testLoop
();
testLoop
();
}
}
static
File
backup
(
String
sourcePath
,
String
targetPath
,
String
basePath
,
int
max
)
throws
Exception
{
static
File
backup
(
String
sourcePath
,
String
targetPath
,
String
basePath
,
int
max
,
String
node
)
throws
Exception
{
File
root
=
new
File
(
targetPath
);
File
root
=
new
File
(
targetPath
);
if
(!
root
.
exists
())
{
if
(!
root
.
exists
())
{
root
.
mkdirs
();
root
.
mkdirs
();
...
@@ -75,7 +79,7 @@ public class TestRecover {
...
@@ -75,7 +79,7 @@ public class TestRecover {
}
}
SimpleDateFormat
sd
=
new
SimpleDateFormat
(
"yyMMdd-HHmmss"
);
SimpleDateFormat
sd
=
new
SimpleDateFormat
(
"yyMMdd-HHmmss"
);
String
date
=
sd
.
format
(
new
Date
());
String
date
=
sd
.
format
(
new
Date
());
File
zipFile
=
new
File
(
root
,
"backup-"
+
date
+
".zip"
);
File
zipFile
=
new
File
(
root
,
"backup-"
+
date
+
"
-"
+
node
+
"
.zip"
);
ArrayList
list
=
new
ArrayList
();
ArrayList
list
=
new
ArrayList
();
File
base
=
new
File
(
sourcePath
);
File
base
=
new
File
(
sourcePath
);
listRecursive
(
list
,
base
);
listRecursive
(
list
,
base
);
...
@@ -108,7 +112,7 @@ public class TestRecover {
...
@@ -108,7 +112,7 @@ public class TestRecover {
in
=
new
FileInputStream
(
fileName
);
in
=
new
FileInputStream
(
fileName
);
IOUtils
.
copyAndCloseInput
(
in
,
zipOut
);
IOUtils
.
copyAndCloseInput
(
in
,
zipOut
);
}
finally
{
}
finally
{
IOUtils
.
closeSilently
(
in
);
IOUtils
.
closeSilently
(
in
);
}
}
zipOut
.
closeEntry
();
zipOut
.
closeEntry
();
}
}
...
@@ -163,7 +167,7 @@ public class TestRecover {
...
@@ -163,7 +167,7 @@ public class TestRecover {
private
void
runOneTest
(
int
i
)
throws
Exception
{
private
void
runOneTest
(
int
i
)
throws
Exception
{
Random
random
=
new
Random
(
i
);
Random
random
=
new
Random
(
i
);
Connection
conn
=
openConnection
();
Connection
conn
=
openConnection
();
PreparedStatement
prep
=
null
;
PreparedStatement
prep
=
null
;
while
(
true
)
{
while
(
true
)
{
boolean
rollback
=
random
.
nextInt
(
10
)
==
1
;
boolean
rollback
=
random
.
nextInt
(
10
)
==
1
;
int
len
;
int
len
;
...
@@ -180,20 +184,20 @@ public class TestRecover {
...
@@ -180,20 +184,20 @@ public class TestRecover {
random
.
nextBytes
(
data
);
random
.
nextBytes
(
data
);
int
op
=
random
.
nextInt
();
int
op
=
random
.
nextInt
();
if
(
op
%
100
==
0
)
{
if
(
op
%
100
==
0
)
{
conn
.
close
();
conn
.
close
();
conn
=
openConnection
();
conn
=
openConnection
();
prep
=
null
;
prep
=
null
;
}
}
if
(
prep
==
null
)
{
if
(
prep
==
null
)
{
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST(NAME) VALUES(?)"
);
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST(NAME) VALUES(?)"
);
conn
.
setAutoCommit
(
false
);
conn
.
setAutoCommit
(
false
);
}
}
prep
.
setString
(
1
,
""
+
len
);
prep
.
setString
(
1
,
""
+
len
);
prep
.
execute
();
prep
.
execute
();
if
(
rollback
)
{
if
(
rollback
)
{
conn
.
rollback
();
conn
.
rollback
();
}
else
{
}
else
{
conn
.
commit
();
conn
.
commit
();
}
}
}
}
}
}
...
@@ -215,11 +219,11 @@ public class TestRecover {
...
@@ -215,11 +219,11 @@ public class TestRecover {
conn
=
openConnection
();
conn
=
openConnection
();
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
String
name
=
rs
.
getString
(
"NAME"
);
String
name
=
rs
.
getString
(
"NAME"
);
int
value
=
Integer
.
parseInt
(
name
);
int
value
=
Integer
.
parseInt
(
name
);
if
(
value
%
2
==
1
)
{
if
(
value
%
2
==
1
)
{
throw
new
Exception
(
"unexpected odd entry "
+
rs
.
getInt
(
"ID"
));
throw
new
Exception
(
"unexpected odd entry "
+
rs
.
getInt
(
"ID"
));
}
}
}
}
conn
.
close
();
conn
.
close
();
return
true
;
return
true
;
...
...
h2/src/tools/org/h2/tools/doc/dictionary.txt
浏览文件 @
a2a2f8ca
...
@@ -478,6 +478,7 @@ incidentally brutal carefully pervasive testlob mydatetime antonio casqueiro syb
...
@@ -478,6 +478,7 @@ incidentally brutal carefully pervasive testlob mydatetime antonio casqueiro syb
pad microsystems dullesopen rpad spot lpad ganelin sssz testabc pst dumping lots
pad microsystems dullesopen rpad spot lpad ganelin sssz testabc pst dumping lots
chdh biz inventec
chdh biz inventec
enclosing mostly dtp scrolls cars splitting replay incomplete automate
enclosing mostly dtp scrolls cars splitting replay incomplete automate
shorten
### evaluatable > evaluable
### evaluatable > evaluable
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论