Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
06fb1080
提交
06fb1080
authored
2月 06, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused code.
上级
a1f890af
全部展开
显示空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
26 行增加
和
995 行删除
+26
-995
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
roadmap.html
h2/src/docsrc/html/roadmap.html
+2
-1
Query.java
h2/src/main/org/h2/command/dml/Query.java
+0
-9
ScriptBase.java
h2/src/main/org/h2/command/dml/ScriptBase.java
+0
-4
Select.java
h2/src/main/org/h2/command/dml/Select.java
+0
-19
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+0
-4
Database.java
h2/src/main/org/h2/engine/Database.java
+0
-8
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+0
-4
UndoLogRecord.java
h2/src/main/org/h2/engine/UndoLogRecord.java
+2
-2
Row.java
h2/src/main/org/h2/result/Row.java
+2
-3
ConnectionInfo.java
h2/src/main/org/h2/server/web/ConnectionInfo.java
+1
-1
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+3
-54
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+1
-4
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+0
-137
Data.java
h2/src/main/org/h2/store/Data.java
+7
-7
DataHandler.java
h2/src/main/org/h2/store/DataHandler.java
+0
-10
DataPage.java
h2/src/main/org/h2/store/DataPage.java
+0
-674
Recover.java
h2/src/main/org/h2/tools/Recover.java
+1
-12
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-22
TestDataPage.java
h2/src/test/org/h2/test/unit/TestDataPage.java
+0
-4
TestFile.java
h2/src/test/org/h2/test/unit/TestFile.java
+0
-4
TestNetUtils.java
h2/src/test/org/h2/test/unit/TestNetUtils.java
+2
-2
TestValueHashMap.java
h2/src/test/org/h2/test/unit/TestValueHashMap.java
+0
-4
TestValueMemory.java
h2/src/test/org/h2/test/unit/TestValueMemory.java
+0
-4
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
06fb1080
...
@@ -18,7 +18,8 @@ Change Log
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
A workaround for a Windows socket problem has been implemented. Thanks a lot to Sergi Vladykin.
<ul><li>
H2 Console: asynchronous login (using a DatabaseEventListener) is no longer supported.
</li><li>
A workaround for a Windows socket problem has been implemented. Thanks a lot to Sergi Vladykin.
</li><li>
The Recover tool did not convert correctly convert CLOB data with non-ASCII characters.
</li><li>
The Recover tool did not convert correctly convert CLOB data with non-ASCII characters.
</li><li>
Tools: the method run(String... args) has been renamed to runTool(String... args)
</li><li>
Tools: the method run(String... args) has been renamed to runTool(String... args)
so it can't be confused with run().
so it can't be confused with run().
...
...
h2/src/docsrc/html/roadmap.html
浏览文件 @
06fb1080
...
@@ -31,7 +31,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
...
@@ -31,7 +31,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
<h2>
Priority 1
</h2>
<h2>
Priority 1
</h2>
<ul>
<ul>
<li>
Bugfixes
<li>
Bugfixes
</li><li>
Issue 157: Support large inserts and updates (use the transaction log for rollback).
</li><li>
Issue
s 161,
157: Support large inserts and updates (use the transaction log for rollback).
Problems: Session.commit (rows), cache, undoLog.
Problems: Session.commit (rows), cache, undoLog.
</li><li>
More tests with MULTI_THREADED=1
</li><li>
More tests with MULTI_THREADED=1
</li><li>
Optimization: result set caching (like MySQL); option to disable
</li><li>
Optimization: result set caching (like MySQL); option to disable
...
@@ -478,6 +478,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
...
@@ -478,6 +478,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>
TCP Server: use a nonce (number used once) to protect unencrypted channels against replay attacks.
</li><li>
TCP Server: use a nonce (number used once) to protect unencrypted channels against replay attacks.
</li><li>
Simplify running scripts and recovery: CREATE FORCE USER (overwrites an existing user).
</li><li>
Simplify running scripts and recovery: CREATE FORCE USER (overwrites an existing user).
</li><li>
Support CREATE DATABASE LINK (a custom JDBC driver is already supported).
</li><li>
Support CREATE DATABASE LINK (a custom JDBC driver is already supported).
</li><li>
Isse 163: Allow to create foreign keys on metadata types.
</li></ul>
</li></ul>
<h2>
Not Planned
</h2>
<h2>
Not Planned
</h2>
...
...
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
06fb1080
...
@@ -152,15 +152,6 @@ public abstract class Query extends Prepared {
...
@@ -152,15 +152,6 @@ public abstract class Query extends Prepared {
*/
*/
public
abstract
void
setDistinct
(
boolean
b
);
public
abstract
void
setDistinct
(
boolean
b
);
/**
* Get the alias (or column name) of the first column.
* This is used to convert IN(SELECT ...) queries to inner joins.
*
* @param s the session
* @return the alias or column name
*/
public
abstract
String
getFirstColumnAlias
(
Session
s
);
/**
/**
* Check if this expression and all sub-expressions can fulfill a criteria.
* Check if this expression and all sub-expressions can fulfill a criteria.
* If any part returns false, the result is false.
* If any part returns false, the result is false.
...
...
h2/src/main/org/h2/command/dml/ScriptBase.java
浏览文件 @
06fb1080
...
@@ -191,10 +191,6 @@ public abstract class ScriptBase extends Prepared implements DataHandler {
...
@@ -191,10 +191,6 @@ public abstract class ScriptBase extends Prepared implements DataHandler {
return
null
;
return
null
;
}
}
public
int
getChecksum
(
byte
[]
data
,
int
start
,
int
end
)
{
return
session
.
getDatabase
().
getChecksum
(
data
,
start
,
end
);
}
public
void
checkPowerOff
()
throws
SQLException
{
public
void
checkPowerOff
()
throws
SQLException
{
session
.
getDatabase
().
checkPowerOff
();
session
.
getDatabase
().
checkPowerOff
();
}
}
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
06fb1080
...
@@ -15,9 +15,7 @@ import org.h2.api.Trigger;
...
@@ -15,9 +15,7 @@ import org.h2.api.Trigger;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Mode
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.expression.Alias
;
import
org.h2.expression.Comparison
;
import
org.h2.expression.Comparison
;
import
org.h2.expression.ConditionAndOr
;
import
org.h2.expression.ConditionAndOr
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
...
@@ -1101,21 +1099,4 @@ public class Select extends Query {
...
@@ -1101,21 +1099,4 @@ public class Select extends Query {
return
isEverything
(
ExpressionVisitor
.
READONLY
);
return
isEverything
(
ExpressionVisitor
.
READONLY
);
}
}
public
String
getFirstColumnAlias
(
Session
s
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
visibleColumnCount
>
1
)
{
Message
.
throwInternalError
(
""
+
visibleColumnCount
);
}
}
Expression
expr
=
expressions
.
get
(
0
);
if
(
expr
instanceof
Alias
)
{
return
expr
.
getAlias
();
}
Mode
mode
=
s
.
getDatabase
().
getMode
();
String
name
=
s
.
getNextSystemIdentifier
(
getSQL
());
expr
=
new
Alias
(
expr
,
name
,
mode
.
aliasColumnName
);
expressions
.
set
(
0
,
expr
);
return
expr
.
getAlias
();
}
}
}
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
06fb1080
...
@@ -349,10 +349,6 @@ public class SelectUnion extends Query {
...
@@ -349,10 +349,6 @@ public class SelectUnion extends Query {
right
.
updateAggregate
(
s
);
right
.
updateAggregate
(
s
);
}
}
public
String
getFirstColumnAlias
(
Session
s
)
{
return
null
;
}
public
void
fireBeforeSelectTriggers
()
throws
SQLException
{
public
void
fireBeforeSelectTriggers
()
throws
SQLException
{
left
.
fireBeforeSelectTriggers
();
left
.
fireBeforeSelectTriggers
();
right
.
fireBeforeSelectTriggers
();
right
.
fireBeforeSelectTriggers
();
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
06fb1080
...
@@ -1264,14 +1264,6 @@ public class Database implements DataHandler {
...
@@ -1264,14 +1264,6 @@ public class Database implements DataHandler {
return
cacheType
;
return
cacheType
;
}
}
public
int
getChecksum
(
byte
[]
data
,
int
start
,
int
end
)
{
int
x
=
0
;
while
(
start
<
end
)
{
x
+=
data
[
start
++];
}
return
x
;
}
public
String
getCluster
()
{
public
String
getCluster
()
{
return
cluster
;
return
cluster
;
}
}
...
...
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
06fb1080
...
@@ -565,10 +565,6 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
...
@@ -565,10 +565,6 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
// nothing to do
// nothing to do
}
}
public
int
getChecksum
(
byte
[]
data
,
int
start
,
int
end
)
{
return
0
;
}
public
String
getDatabasePath
()
{
public
String
getDatabasePath
()
{
return
""
;
return
""
;
}
}
...
...
h2/src/main/org/h2/engine/UndoLogRecord.java
浏览文件 @
06fb1080
...
@@ -137,7 +137,7 @@ public class UndoLogRecord {
...
@@ -137,7 +137,7 @@ public class UndoLogRecord {
}
}
/**
/**
* Save the row in the file using
the data page as
a buffer.
* Save the row in the file using a buffer.
*
*
* @param buff the buffer
* @param buff the buffer
* @param file the file
* @param file the file
...
@@ -164,7 +164,7 @@ public class UndoLogRecord {
...
@@ -164,7 +164,7 @@ public class UndoLogRecord {
}
}
/**
/**
* Load an undo log record row using
the data page as
a buffer.
* Load an undo log record row using a buffer.
*
*
* @param buff the buffer
* @param buff the buffer
* @param file the source file
* @param file the source file
...
...
h2/src/main/org/h2/result/Row.java
浏览文件 @
06fb1080
...
@@ -54,10 +54,9 @@ public class Row implements SearchRow {
...
@@ -54,10 +54,9 @@ public class Row implements SearchRow {
}
}
/**
/**
* Get the number of bytes required for the data if the given data page
* Get the number of bytes required for the data.
* would be used.
*
*
* @param dummy the template
data page
* @param dummy the template
buffer
* @return the number of bytes
* @return the number of bytes
*/
*/
public
int
getByteCount
(
Data
dummy
)
throws
SQLException
{
public
int
getByteCount
(
Data
dummy
)
throws
SQLException
{
...
...
h2/src/main/org/h2/server/web/ConnectionInfo.java
浏览文件 @
06fb1080
...
@@ -61,7 +61,7 @@ public class ConnectionInfo implements Comparable<ConnectionInfo> {
...
@@ -61,7 +61,7 @@ public class ConnectionInfo implements Comparable<ConnectionInfo> {
}
}
public
int
compareTo
(
ConnectionInfo
o
)
{
public
int
compareTo
(
ConnectionInfo
o
)
{
return
MathUtils
.
compareInt
(
lastAccess
,
o
.
lastAccess
);
return
-
MathUtils
.
compareInt
(
lastAccess
,
o
.
lastAccess
);
}
}
}
}
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
06fb1080
...
@@ -27,7 +27,6 @@ import java.util.Locale;
...
@@ -27,7 +27,6 @@ import java.util.Locale;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.bnf.Bnf
;
import
org.h2.bnf.Bnf
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.constant.SysProperties
;
...
@@ -58,14 +57,12 @@ import org.h2.util.Tool;
...
@@ -58,14 +57,12 @@ import org.h2.util.Tool;
* For each connection to a session, an object of this class is created.
* For each connection to a session, an object of this class is created.
* This class is used by the H2 Console.
* This class is used by the H2 Console.
*/
*/
public
class
WebApp
implements
DatabaseEventListener
{
public
class
WebApp
{
protected
WebServer
server
;
protected
WebServer
server
;
protected
WebSession
session
;
protected
WebSession
session
;
protected
Properties
attributes
;
protected
Properties
attributes
;
protected
String
mimeType
;
protected
String
mimeType
;
protected
long
listenerLastEvent
;
protected
int
listenerLastState
;
protected
boolean
cache
;
protected
boolean
cache
;
protected
boolean
stop
;
protected
boolean
stop
;
protected
String
headerLanguage
;
protected
String
headerLanguage
;
...
@@ -792,7 +789,7 @@ public class WebApp implements DatabaseEventListener {
...
@@ -792,7 +789,7 @@ public class WebApp implements DatabaseEventListener {
prof
.
startCollecting
();
prof
.
startCollecting
();
Connection
conn
;
Connection
conn
;
try
{
try
{
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
,
this
);
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
);
}
finally
{
}
finally
{
prof
.
stopCollecting
();
prof
.
stopCollecting
();
profOpen
=
prof
.
getTop
(
3
);
profOpen
=
prof
.
getTop
(
3
);
...
@@ -854,7 +851,7 @@ public class WebApp implements DatabaseEventListener {
...
@@ -854,7 +851,7 @@ public class WebApp implements DatabaseEventListener {
}
}
boolean
isH2
=
url
.
startsWith
(
"jdbc:h2:"
);
boolean
isH2
=
url
.
startsWith
(
"jdbc:h2:"
);
try
{
try
{
Connection
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
,
this
);
Connection
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
);
session
.
setConnection
(
conn
);
session
.
setConnection
(
conn
);
session
.
put
(
"url"
,
url
);
session
.
put
(
"url"
,
url
);
session
.
put
(
"user"
,
user
);
session
.
put
(
"user"
,
user
);
...
@@ -1715,54 +1712,6 @@ public class WebApp implements DatabaseEventListener {
...
@@ -1715,54 +1712,6 @@ public class WebApp implements DatabaseEventListener {
return
session
;
return
session
;
}
}
public
void
closingDatabase
()
{
trace
(
"Closing database"
);
}
public
void
diskSpaceIsLow
(
long
stillAvailable
)
{
trace
(
"No more disk space is available"
);
}
public
void
exceptionThrown
(
SQLException
e
,
String
sql
)
{
trace
(
"Exception: "
+
e
.
toString
()
+
" SQL: "
+
sql
);
}
public
void
init
(
String
url
)
{
trace
(
"Init: "
+
url
);
}
public
void
opened
()
{
trace
(
"Database was opened"
);
}
public
void
setProgress
(
int
state
,
String
name
,
int
x
,
int
max
)
{
if
(
state
==
listenerLastState
)
{
long
time
=
System
.
currentTimeMillis
();
if
(
listenerLastEvent
+
500
<
time
)
{
return
;
}
listenerLastEvent
=
time
;
}
else
{
listenerLastState
=
state
;
}
switch
(
state
)
{
case
DatabaseEventListener
.
STATE_BACKUP_FILE
:
trace
(
"Backing up "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
case
DatabaseEventListener
.
STATE_CREATE_INDEX
:
trace
(
"Creating index "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
case
DatabaseEventListener
.
STATE_RECOVER
:
trace
(
"Recovering "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
case
DatabaseEventListener
.
STATE_SCAN_FILE
:
trace
(
"Scanning file "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
default
:
trace
(
"Unknown state: "
+
state
);
}
}
private
void
trace
(
String
s
)
{
private
void
trace
(
String
s
)
{
server
.
trace
(
s
);
server
.
trace
(
s
);
}
}
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
06fb1080
...
@@ -26,7 +26,6 @@ import java.util.Properties;
...
@@ -26,7 +26,6 @@ import java.util.Properties;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.TimeZone
;
import
java.util.TimeZone
;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.constant.SysProperties
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.message.TraceSystem
;
import
org.h2.message.TraceSystem
;
...
@@ -570,10 +569,9 @@ public class WebServer implements Service {
...
@@ -570,10 +569,9 @@ public class WebServer implements Service {
* @param databaseUrl the database URL
* @param databaseUrl the database URL
* @param user the user name
* @param user the user name
* @param password the password
* @param password the password
* @param listener the database event listener object
* @return the database connection
* @return the database connection
*/
*/
Connection
getConnection
(
String
driver
,
String
databaseUrl
,
String
user
,
String
password
,
DatabaseEventListener
listener
)
throws
SQLException
{
Connection
getConnection
(
String
driver
,
String
databaseUrl
,
String
user
,
String
password
)
throws
SQLException
{
driver
=
driver
.
trim
();
driver
=
driver
.
trim
();
databaseUrl
=
databaseUrl
.
trim
();
databaseUrl
=
databaseUrl
.
trim
();
org
.
h2
.
Driver
.
load
();
org
.
h2
.
Driver
.
load
();
...
@@ -586,7 +584,6 @@ public class WebServer implements Service {
...
@@ -586,7 +584,6 @@ public class WebServer implements Service {
if
(
ifExists
)
{
if
(
ifExists
)
{
databaseUrl
+=
";IFEXISTS=TRUE"
;
databaseUrl
+=
";IFEXISTS=TRUE"
;
}
}
p
.
put
(
"DATABASE_EVENT_LISTENER_OBJECT"
,
listener
);
// PostgreSQL would throw a NullPointerException
// PostgreSQL would throw a NullPointerException
// if it is loaded before the H2 driver
// if it is loaded before the H2 driver
// because it can't deal with non-String objects in the connection Properties
// because it can't deal with non-String objects in the connection Properties
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
06fb1080
...
@@ -11,19 +11,11 @@ import java.io.BufferedOutputStream;
...
@@ -11,19 +11,11 @@ import java.io.BufferedOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.io.PrintWriter
;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.engine.Constants
;
import
org.h2.message.TraceSystem
;
import
org.h2.message.TraceSystem
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.MemoryUtils
;
import
org.h2.util.MemoryUtils
;
...
@@ -285,135 +277,6 @@ class WebThread extends WebApp implements Runnable {
...
@@ -285,135 +277,6 @@ class WebThread extends WebApp implements Runnable {
return
super
.
adminShutdown
();
return
super
.
adminShutdown
();
}
}
protected
boolean
loginAsync
(
final
String
driver
,
final
String
url
,
final
String
user
,
final
String
password
)
{
if
(
socket
==
null
||
!
url
.
startsWith
(
"jdbc:h2:"
)
||
url
.
startsWith
(
"jdbc:h2:tcp:"
)
||
url
.
startsWith
(
"jdbc:h2:ssl:"
)
||
url
.
startsWith
(
"jdbc:h2:mem:"
))
{
// async login only possible for H2 embedded
return
false
;
}
/**
* This class is used for the asynchronous login.
*/
class
LoginTask
implements
Runnable
,
DatabaseEventListener
{
private
final
PrintWriter
writer
;
private
final
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"HH:mm:ss.SSS"
);
LoginTask
()
throws
IOException
{
String
message
=
"HTTP/1.1 200 OK\n"
;
message
+=
"Content-Type: "
+
mimeType
+
"\n\n"
;
output
.
write
(
message
.
getBytes
());
writer
=
new
PrintWriter
(
output
);
writer
.
println
(
"<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" /></head>"
);
writer
.
println
(
"<body><h2>Opening Database</h2>URL: "
+
PageParser
.
escapeHtml
(
url
)
+
"<br />"
);
writer
.
println
(
"User: "
+
PageParser
.
escapeHtml
(
user
)
+
"<br />"
);
writer
.
println
(
"Version: "
+
Constants
.
getFullVersion
()
+
"<br /><br />"
);
writer
.
flush
();
log
(
"Start..."
);
}
public
void
closingDatabase
()
{
log
(
"Closing database"
);
}
public
void
diskSpaceIsLow
(
long
stillAvailable
)
{
log
(
"No more disk space is available"
);
}
public
void
exceptionThrown
(
SQLException
e
,
String
sql
)
{
log
(
"Exception: "
+
PageParser
.
escapeHtml
(
e
.
toString
())
+
" SQL: "
+
PageParser
.
escapeHtml
(
sql
));
server
.
traceError
(
e
);
}
public
void
init
(
String
databaseUrl
)
{
log
(
"Init: "
+
PageParser
.
escapeHtml
(
databaseUrl
));
}
public
void
opened
()
{
log
(
"Database was opened"
);
}
public
void
setProgress
(
int
state
,
String
name
,
int
x
,
int
max
)
{
if
(
state
==
listenerLastState
)
{
long
time
=
System
.
currentTimeMillis
();
if
(
time
<
listenerLastEvent
+
1000
)
{
return
;
}
listenerLastEvent
=
time
;
}
else
{
listenerLastState
=
state
;
}
name
=
PageParser
.
escapeHtml
(
name
);
switch
(
state
)
{
case
DatabaseEventListener
.
STATE_BACKUP_FILE
:
log
(
"Backing up "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
case
DatabaseEventListener
.
STATE_CREATE_INDEX
:
log
(
"Creating index "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
case
DatabaseEventListener
.
STATE_RECOVER
:
log
(
"Recovering "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
case
DatabaseEventListener
.
STATE_SCAN_FILE
:
log
(
"Scanning file "
+
name
+
" "
+
(
100L
*
x
/
max
)
+
"%"
);
break
;
default
:
log
(
"Unknown state: "
+
state
);
}
}
private
synchronized
void
log
(
String
message
)
{
if
(
output
!=
null
)
{
message
=
dateFormat
.
format
(
new
Date
())
+
": "
+
message
;
writer
.
println
(
message
+
"<br />"
);
writer
.
flush
();
}
server
.
trace
(
message
);
}
public
void
run
()
{
String
sessionId
=
(
String
)
session
.
get
(
"sessionId"
);
boolean
isH2
=
url
.
startsWith
(
"jdbc:h2:"
);
try
{
Connection
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
,
this
);
session
.
setConnection
(
conn
);
session
.
put
(
"url"
,
url
);
session
.
put
(
"user"
,
user
);
session
.
remove
(
"error"
);
settingSave
();
log
(
"OK<script type=\"text/javascript\">top.location=\"frame.jsp?jsessionid="
+
sessionId
+
"\"</script></body></htm>"
);
// return "frame.jsp";
}
catch
(
Exception
e
)
{
session
.
put
(
"error"
,
getLoginError
(
e
,
isH2
));
log
(
"Error<script type=\"text/javascript\">top.location=\"index.jsp?jsessionid="
+
sessionId
+
"\"</script></body></html>"
);
// return "index.jsp";
}
synchronized
(
this
)
{
IOUtils
.
closeSilently
(
output
);
try
{
socket
.
close
();
}
catch
(
IOException
e
)
{
// ignore
}
output
=
null
;
}
}
}
try
{
LoginTask
login
=
new
LoginTask
();
Thread
t
=
new
Thread
(
login
);
t
.
start
();
}
catch
(
IOException
e
)
{
// ignore
}
return
true
;
}
private
boolean
allow
()
{
private
boolean
allow
()
{
if
(
server
.
getAllowOthers
())
{
if
(
server
.
getAllowOthers
())
{
return
true
;
return
true
;
...
...
h2/src/main/org/h2/store/Data.java
浏览文件 @
06fb1080
...
@@ -44,7 +44,7 @@ import org.h2.value.ValueTimestamp;
...
@@ -44,7 +44,7 @@ import org.h2.value.ValueTimestamp;
import
org.h2.value.ValueUuid
;
import
org.h2.value.ValueUuid
;
/**
/**
*
A data page i
s a byte buffer that contains persistent data of a page.
*
This class represent
s a byte buffer that contains persistent data of a page.
*/
*/
public
class
Data
{
public
class
Data
{
...
@@ -237,31 +237,31 @@ public class Data {
...
@@ -237,31 +237,31 @@ public class Data {
}
}
/**
/**
* Create a new
data page
for the given handler. The
* Create a new
buffer
for the given handler. The
* handler will decide what type of buffer is created.
* handler will decide what type of buffer is created.
*
*
* @param handler the data handler
* @param handler the data handler
* @param capacity the initial capacity of the buffer
* @param capacity the initial capacity of the buffer
* @return the
data page
* @return the
buffer
*/
*/
public
static
Data
create
(
DataHandler
handler
,
int
capacity
)
{
public
static
Data
create
(
DataHandler
handler
,
int
capacity
)
{
return
new
Data
(
handler
,
new
byte
[
capacity
]);
return
new
Data
(
handler
,
new
byte
[
capacity
]);
}
}
/**
/**
* Create a new
data page
using the given data for the given handler. The
* Create a new
buffer
using the given data for the given handler. The
* handler will decide what type of buffer is created.
* handler will decide what type of buffer is created.
*
*
* @param handler the data handler
* @param handler the data handler
* @param buff the data
* @param buff the data
* @return the
data page
* @return the
buffer
*/
*/
public
static
Data
create
(
DataHandler
handler
,
byte
[]
buff
)
{
public
static
Data
create
(
DataHandler
handler
,
byte
[]
buff
)
{
return
new
Data
(
handler
,
buff
);
return
new
Data
(
handler
,
buff
);
}
}
/**
/**
* Get the current write position of this
data page
, which is the current
* Get the current write position of this
buffer
, which is the current
* length.
* length.
*
*
* @return the length
* @return the length
...
@@ -287,7 +287,7 @@ public class Data {
...
@@ -287,7 +287,7 @@ public class Data {
}
}
/**
/**
* Append a number of bytes to this
data page
.
* Append a number of bytes to this
buffer
.
*
*
* @param buff the data
* @param buff the data
* @param off the offset in the data
* @param off the offset in the data
...
...
h2/src/main/org/h2/store/DataHandler.java
浏览文件 @
06fb1080
...
@@ -35,16 +35,6 @@ public interface DataHandler {
...
@@ -35,16 +35,6 @@ public interface DataHandler {
*/
*/
FileStore
openFile
(
String
name
,
String
mode
,
boolean
mustExist
)
throws
SQLException
;
FileStore
openFile
(
String
name
,
String
mode
,
boolean
mustExist
)
throws
SQLException
;
/**
* Calculate the checksum for the byte array.
*
* @param data the byte array
* @param start the starting offset
* @param end the end offset
* @return the checksum
*/
int
getChecksum
(
byte
[]
data
,
int
start
,
int
end
);
/**
/**
* Check if the simulated power failure occurred.
* Check if the simulated power failure occurred.
* This call will decrement the countdown.
* This call will decrement the countdown.
...
...
h2/src/main/org/h2/store/DataPage.java
deleted
100644 → 0
浏览文件 @
a1f890af
差异被折叠。
点击展开。
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
06fb1080
...
@@ -691,7 +691,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -691,7 +691,7 @@ public class Recover extends Tool implements DataHandler {
if
(
d
==
dataPage
)
{
if
(
d
==
dataPage
)
{
dataPage
=
0
;
dataPage
=
0
;
}
else
{
}
else
{
// ignore the pages before the starting
data
page
// ignore the pages before the starting page
continue
;
continue
;
}
}
}
}
...
@@ -1124,17 +1124,6 @@ public class Recover extends Tool implements DataHandler {
...
@@ -1124,17 +1124,6 @@ public class Recover extends Tool implements DataHandler {
return
FileStore
.
open
(
this
,
name
,
"rw"
);
return
FileStore
.
open
(
this
,
name
,
"rw"
);
}
}
/**
* INTERNAL
*/
public
int
getChecksum
(
byte
[]
data
,
int
start
,
int
end
)
{
int
x
=
0
;
while
(
start
<
end
)
{
x
+=
data
[
start
++];
}
return
x
;
}
/**
/**
* INTERNAL
* INTERNAL
*/
*/
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
06fb1080
...
@@ -33,7 +33,7 @@ import org.h2.util.StringUtils;
...
@@ -33,7 +33,7 @@ import org.h2.util.StringUtils;
/**
/**
* Implementation of the BLOB and CLOB data types. Small objects are kept in
* Implementation of the BLOB and CLOB data types. Small objects are kept in
* memory and stored in the
data page of the
record.
* memory and stored in the record.
*
*
* Large objects are stored in their own files. When large objects are set in a
* Large objects are stored in their own files. When large objects are set in a
* prepared statement, they are first stored as 'temporary' files. Later, when
* prepared statement, they are first stored as 'temporary' files. Later, when
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
06fb1080
...
@@ -287,37 +287,17 @@ java org.h2.test.TestAll timer
...
@@ -287,37 +287,17 @@ java org.h2.test.TestAll timer
System
.
setProperty
(
"h2.check2"
,
"true"
);
System
.
setProperty
(
"h2.check2"
,
"true"
);
/*
/*
check client jar file size
FileStore.sync, Database.sync() (CHECKPOINT SYNC)
simplify Message / ErrorCode / Resource
remove BitField
flatten package hierarchy (remove constant package)
Constants.FILE_BLOCK_SIZE and others
simplify SysProperties; combine with Constants
remove SortedProperties
remove TempFileDeleter (UndoLog, ResultDiskBuffer, RowList, ValueLob)
combine small classes (StringCache / utils...)
document in performance section:
document in performance section:
PreparedStatement prep = conn.prepareStatement(
PreparedStatement prep = conn.prepareStatement(
"select * from table(x int = ?) t inner join test on t.x = test.id");
"select * from table(x int = ?) t inner join test on t.x = test.id");
prep.setObject(1, new Object[] { "1", "2" });
prep.setObject(1, new Object[] { "1", "2" });
ResultSet rs = prep.executeQuery();
ResultSet rs = prep.executeQuery();
remove unused methods
review package and class level javadocs
cleanup SortedProperties
headPos > boolean isNew?
verify Row - Page
fix class javadocs
test remote lob (temp file) read write
TestAll deleteIndex
TestAll deleteIndex
FileStore.sync, Database.sync() (CHECKPOINT SYNC)
data page > buffer
try to reduce number of packages, classes
rename Page classes to normal names
use RuntimeException internally
use RuntimeException internally
Verify that Tomcat memory leak protection don't cause exceptions:
http://java.dzone.com/articles/memory-leak-protection-tomcat
document FETCH FIRST
document FETCH FIRST
power failure test: larger binaries and additional indexes
power failure test: larger binaries and additional indexes
...
...
h2/src/test/org/h2/test/unit/TestDataPage.java
浏览文件 @
06fb1080
...
@@ -271,10 +271,6 @@ public class TestDataPage extends TestBase implements DataHandler {
...
@@ -271,10 +271,6 @@ public class TestDataPage extends TestBase implements DataHandler {
return
null
;
return
null
;
}
}
public
int
getChecksum
(
byte
[]
data
,
int
s
,
int
e
)
{
return
e
-
s
;
}
public
void
checkPowerOff
()
{
public
void
checkPowerOff
()
{
// nothing to do
// nothing to do
}
}
...
...
h2/src/test/org/h2/test/unit/TestFile.java
浏览文件 @
06fb1080
...
@@ -146,10 +146,6 @@ public class TestFile extends TestBase implements DataHandler {
...
@@ -146,10 +146,6 @@ public class TestFile extends TestBase implements DataHandler {
// nothing to do
// nothing to do
}
}
public
int
getChecksum
(
byte
[]
data
,
int
s
,
int
e
)
{
return
0
;
}
public
String
getDatabasePath
()
{
public
String
getDatabasePath
()
{
return
null
;
return
null
;
}
}
...
...
h2/src/test/org/h2/test/unit/TestNetUtils.java
浏览文件 @
06fb1080
...
@@ -48,13 +48,13 @@ public class TestNetUtils extends TestBase {
...
@@ -48,13 +48,13 @@ public class TestNetUtils extends TestBase {
while
(!
isInterrupted
())
{
while
(!
isInterrupted
())
{
try
{
try
{
Socket
socket
=
serverSocket
.
accept
();
Socket
socket
=
serverSocket
.
accept
();
System
.
out
.
println
(
"opened "
+
counter
);
//
System.out.println("opened " + counter);
socket
.
close
();
socket
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// ignore
// ignore
}
}
}
}
System
.
out
.
println
(
"stopped "
);
//
System.out.println("stopped ");
}
}
};
};
...
...
h2/src/test/org/h2/test/unit/TestValueHashMap.java
浏览文件 @
06fb1080
...
@@ -120,10 +120,6 @@ public class TestValueHashMap extends TestBase implements DataHandler {
...
@@ -120,10 +120,6 @@ public class TestValueHashMap extends TestBase implements DataHandler {
return
null
;
return
null
;
}
}
public
int
getChecksum
(
byte
[]
data
,
int
s
,
int
e
)
{
return
0
;
}
public
void
checkPowerOff
()
{
public
void
checkPowerOff
()
{
// nothing to do
// nothing to do
}
}
...
...
h2/src/test/org/h2/test/unit/TestValueMemory.java
浏览文件 @
06fb1080
...
@@ -194,10 +194,6 @@ public class TestValueMemory extends TestBase implements DataHandler {
...
@@ -194,10 +194,6 @@ public class TestValueMemory extends TestBase implements DataHandler {
// nothing to do
// nothing to do
}
}
public
int
getChecksum
(
byte
[]
data
,
int
s
,
int
e
)
{
return
0
;
}
public
String
getDatabasePath
()
{
public
String
getDatabasePath
()
{
return
baseDir
+
"/valueMemory"
;
return
baseDir
+
"/valueMemory"
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论