Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4ba52d30
提交
4ba52d30
authored
6月 04, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
ad1a436f
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
193 行增加
和
23 行删除
+193
-23
build.xml
h2/build.xml
+1
-1
advanced.html
h2/src/docsrc/html/advanced.html
+29
-0
BtreeIndex.java
h2/src/main/org/h2/index/BtreeIndex.java
+1
-1
_messages_de.properties
h2/src/main/org/h2/res/_messages_de.properties
+1
-1
help.csv
h2/src/main/org/h2/res/help.csv
+5
-3
DiskFile.java
h2/src/main/org/h2/store/DiskFile.java
+42
-7
FileStore.java
h2/src/main/org/h2/store/FileStore.java
+111
-2
Storage.java
h2/src/main/org/h2/store/Storage.java
+0
-4
ObjectArray.java
h2/src/main/org/h2/util/ObjectArray.java
+1
-1
Tool.java
h2/src/main/org/h2/util/Tool.java
+0
-1
web.xml
h2/src/tools/WEB-INF/web.xml
+1
-1
MergeDocs.java
h2/src/tools/org/h2/build/doc/MergeDocs.java
+1
-1
没有找到文件。
h2/build.xml
浏览文件 @
4ba52d30
...
...
@@ -108,7 +108,7 @@
</target>
<target
name=
"switchSourcePrepare"
depends=
"clean"
>
<javac
srcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
includes=
"org/h2/build/code/SwitchSource.java"
/>
<javac
s
ource=
"1.4"
s
rcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
includes=
"org/h2/build/code/SwitchSource.java"
/>
</target>
<target
name=
"switchSourceAndroid"
depends=
"switchSourcePrepare"
>
...
...
h2/src/docsrc/html/advanced.html
浏览文件 @
4ba52d30
...
...
@@ -58,6 +58,8 @@ Advanced Topics
Settings Read from System Properties
</a><br
/>
<a
href=
"#server_bind_address"
>
Setting the Server Bind Address
</a><br
/>
<a
href=
"#limitations"
>
Limitations
</a><br
/>
<a
href=
"#glossary_links"
>
Glossary and Links
</a><br
/>
...
...
@@ -1061,6 +1063,33 @@ This setting is used for both regular server sockets and for SSL server sockets.
IPv4 and IPv6 address formats are supported.
</p>
<br
/><a
name=
"limitations"
></a>
<h2>
Limitations
</h2>
<p>
This database has the following known limitations:
</p>
<ul>
<li>
The maximum file size is currently 256 GB for the data, and 256 GB for the index.
This number is excluding BLOB and CLOB data:
Every CLOB or BLOB can be up to 256 GB as well.
</li><li>
The maximum file size for FAT or FAT32 file systems is 4 GB. That means when using FAT or FAT32,
the limit is 4 GB for the data. This is the limitation of the file system, and this database does not provide a
workaround for this problem. The suggested solution is to use another file system.
</li><li>
There is a limit on the complexity of SQL statements.
Statements of the following form will result in a stack overflow exception:
<pre>
SELECT * FROM DUAL WHERE X = 1
OR X = 2 OR X = 2 OR X = 2 OR X = 2 OR X = 2
-- repeat previous line 500 times --
</pre>
</li><li>
There is no limit for the following entities, except the memory and storage capacity:
maximum identifier length, maximum number of tables, maximum number of columns,
maximum number of indexes, maximum number of parameters,
maximum number of triggers, and maximum number of other database objects.
</li><li>
For limitations on data types, see the documentation of the respective Java data type
or the data type documentation of this database.
</ul>
<br
/><a
name=
"glossary_links"
></a>
<h2>
Glossary and Links
</h2>
<table><tr><th>
Term
</th><th>
Description
</th></tr>
...
...
h2/src/main/org/h2/index/BtreeIndex.java
浏览文件 @
4ba52d30
...
...
@@ -162,7 +162,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
public
void
flush
(
Session
session
)
throws
SQLException
{
lastChange
=
0
;
if
(
storage
!=
null
)
{
storage
.
flushFile
();
storage
.
getDiskFile
().
flush
();
if
(!
database
.
getReadOnly
())
{
deletePage
(
session
,
head
);
// if we log index changes now, then the index is consistent
...
...
h2/src/main/org/h2/res/_messages_de.properties
浏览文件 @
4ba52d30
...
...
@@ -46,7 +46,7 @@
90023
=
Feld {0} darf nicht NULL nicht erlauben
90024
=
Fehler beim Umbenennen der Datei {0} nach {1}
90025
=
Kann Datei {0} nicht l
\u
00F6schen
90026
=
Serialisierung fehlgeschlagen, Grund
\:
{}
90026
=
Serialisierung fehlgeschlagen, Grund
\:
{
0
}
90027
=
De-Serialisierung fehlgeschlagen, Grund
\:
{1}
90028
=
Eingabe/Ausgabe Fehler
\:
{0}
90029
=
Im Moment nicht auf einer ver
\u
00E4nderbaren Zeile
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
4ba52d30
...
...
@@ -1469,14 +1469,15 @@ Number with fixed precision and scale.
[- | +] digit [...]
[. digit [...] [E [- | +] exponentDigit [...] ]]
","
The
re is no minimum or maximum number
.
The
limitations are the same as for the Java data type Double
.
","
-1.4e-10
"
"Other Grammar","Date","
DATE 'yyyy-MM-dd'
","
A date literal.
A date literal. The limitations are the same as for the Java data type java.sql.Date, but
for compatibility with other databases the suggested minimum and maximum years are 0001 and 9999.
","
DATE '2004-12-31'
"
...
...
@@ -1490,7 +1491,8 @@ TIME '23:59:59'
"Other Grammar","Timestamp","
TIMESTAMP 'yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]'
","
A timestamp literal.
A timestamp literal. The limitations are the same as for the Java data type java.sql.Timestamp, but
for compatibility with other databases the suggested minimum and maximum years are 0001 and 9999.
","
TIMESTAMP '2005-12-31 23:59:59'
"
...
...
h2/src/main/org/h2/store/DiskFile.java
浏览文件 @
4ba52d30
...
...
@@ -75,11 +75,11 @@ public class DiskFile implements CacheWriter {
*/
public
static
final
int
BLOCK_SIZE
=
128
;
// TODO storage: header should probably be 4 KB or so
// (to match block size of operating system)
private
static
final
int
OFFSET
=
FileStore
.
HEADER_LENGTH
;
private
static
final
int
FREE_PAGE
=
-
1
;
// TODO storage: header should probably be 4 KB or so
// (to match block size of operating system)
private
Database
database
;
private
String
fileName
;
private
FileStore
file
;
...
...
@@ -183,6 +183,11 @@ public class DiskFile implements CacheWriter {
}
}
/**
* Get the 'storage allocation table' of this file.
*
* @return the table
*/
public
byte
[]
getSummary
()
throws
SQLException
{
synchronized
(
database
)
{
try
{
...
...
@@ -241,6 +246,11 @@ public class DiskFile implements CacheWriter {
return
true
;
}
/**
* Initialize the the 'storage allocation table' of this file from a given byte array.
*
* @param summary the storage allocation table
*/
public
void
initFromSummary
(
byte
[]
summary
)
{
synchronized
(
database
)
{
if
(
summary
==
null
||
summary
.
length
==
0
)
{
...
...
@@ -339,7 +349,9 @@ public class DiskFile implements CacheWriter {
}
}
/**
* Read the 'storage allocation table' from the file if required.
*/
public
void
init
()
throws
SQLException
{
synchronized
(
database
)
{
if
(
init
)
{
...
...
@@ -389,6 +401,9 @@ public class DiskFile implements CacheWriter {
}
}
/**
* Flush all pending changes to disk.
*/
public
void
flush
()
throws
SQLException
{
synchronized
(
database
)
{
database
.
checkPowerOff
();
...
...
@@ -440,6 +455,9 @@ public class DiskFile implements CacheWriter {
// }
// }
/**
* Flush all pending changes and close the file.
*/
public
void
close
()
throws
SQLException
{
synchronized
(
database
)
{
SQLException
closeException
=
null
;
...
...
@@ -678,6 +696,12 @@ public class DiskFile implements CacheWriter {
return
pageOwners
.
get
(
page
);
}
/**
* Set the owner of a page.
*
* @param page the page id
* @param the storage id of this page
*/
public
void
setPageOwner
(
int
page
,
int
storageId
)
throws
SQLException
{
int
old
=
pageOwners
.
get
(
page
);
if
(
old
==
storageId
)
{
...
...
@@ -721,6 +745,9 @@ public class DiskFile implements CacheWriter {
}
}
/**
* Close the file and delete it.
*/
public
void
delete
()
throws
SQLException
{
synchronized
(
database
)
{
try
{
...
...
@@ -749,6 +776,12 @@ public class DiskFile implements CacheWriter {
// return start;
// }
/**
* Write a record to the file immediately.
* This method is called by the cache, and when flushing pending changes.
*
* @param obj the record to write
*/
public
void
writeBack
(
CacheObject
obj
)
throws
SQLException
{
synchronized
(
database
)
{
writeCount
++;
...
...
@@ -769,8 +802,10 @@ public class DiskFile implements CacheWriter {
}
}
/*
* Must be synchronized externally
/**
* Get the usage bits. The bit field must be synchronized externally.
*
* @return the bit field of used blocks.
*/
BitField
getUsed
()
{
return
used
;
...
...
@@ -901,11 +936,11 @@ public class DiskFile implements CacheWriter {
}
}
public
int
getRecordOverhead
()
{
int
getRecordOverhead
()
{
return
recordOverhead
;
}
public
void
truncateStorage
(
Session
session
,
Storage
storage
,
IntArray
pages
)
throws
SQLException
{
void
truncateStorage
(
Session
session
,
Storage
storage
,
IntArray
pages
)
throws
SQLException
{
synchronized
(
database
)
{
int
storageId
=
storage
.
getId
();
// make sure the cache records of this storage are not flushed to disk
...
...
h2/src/main/org/h2/store/FileStore.java
浏览文件 @
4ba52d30
...
...
@@ -27,11 +27,28 @@ import org.h2.util.TempFileDeleter;
*/
public
class
FileStore
{
/**
* The size of the file header in bytes.
*/
public
static
final
int
HEADER_LENGTH
=
3
*
Constants
.
FILE_BLOCK_SIZE
;
/**
* An empty buffer to speed up extending the file (it seems that writing 0
* bytes is faster then calling setLength).
*/
protected
static
final
byte
[]
EMPTY
=
new
byte
[
16
*
1024
];
/**
* The file name.
*/
protected
String
name
;
/**
* The callback object is responsible to check access rights, and free up
* disk space if required.
*/
protected
DataHandler
handler
;
private
byte
[]
magic
;
private
FileObject
file
;
private
long
filePos
;
...
...
@@ -41,6 +58,14 @@ public class FileStore {
private
boolean
synchronousMode
;
private
String
mode
;
/**
* Create a new file using the given settings.
*
* @param handler the callback object
* @param name the file name
* @param mode the access mode ("r", "rw", "rws", "rwd")
* @param magic the magic file header
*/
protected
FileStore
(
DataHandler
handler
,
String
name
,
String
mode
,
byte
[]
magic
)
throws
SQLException
{
FileSystem
fs
=
FileSystem
.
getInstance
(
name
);
this
.
handler
=
handler
;
...
...
@@ -131,18 +156,22 @@ public class FileStore {
this
.
checkedWriting
=
value
;
}
pr
otected
void
checkWritingAllowed
()
throws
SQLException
{
pr
ivate
void
checkWritingAllowed
()
throws
SQLException
{
if
(
handler
!=
null
&&
checkedWriting
)
{
handler
.
checkWritingAllowed
();
}
}
pr
otected
void
checkPowerOff
()
throws
SQLException
{
pr
ivate
void
checkPowerOff
()
throws
SQLException
{
if
(
handler
!=
null
)
{
handler
.
checkPowerOff
();
}
}
/**
* Initialize the file. This method will write or check the file header if
* required.
*/
public
void
init
()
throws
SQLException
{
int
len
=
Constants
.
FILE_BLOCK_SIZE
;
byte
[]
salt
;
...
...
@@ -175,6 +204,9 @@ public class FileStore {
}
}
/**
* Close the file.
*/
public
void
close
()
throws
IOException
{
if
(
file
!=
null
)
{
try
{
...
...
@@ -186,6 +218,10 @@ public class FileStore {
}
}
/**
* Close the file without throwing any exceptions. Exceptions are simply
* ignored.
*/
public
void
closeSilently
()
{
try
{
close
();
...
...
@@ -194,6 +230,9 @@ public class FileStore {
}
}
/**
* Close the file (ignoring exceptions) and delete the file.
*/
public
void
closeAndDeleteSilently
()
{
if
(
file
!=
null
)
{
closeSilently
();
...
...
@@ -202,10 +241,24 @@ public class FileStore {
}
}
/**
* Read a number of bytes without decrypting.
*
* @param b the target buffer
* @param off the offset
* @param len the number of bytes to read
*/
protected
void
readFullyDirect
(
byte
[]
b
,
int
off
,
int
len
)
throws
SQLException
{
readFully
(
b
,
off
,
len
);
}
/**
* Read a number of bytes.
*
* @param b the target buffer
* @param off the offset
* @param len the number of bytes to read
*/
public
void
readFully
(
byte
[]
b
,
int
off
,
int
len
)
throws
SQLException
{
if
(
SysProperties
.
CHECK
&&
len
<
0
)
{
throw
Message
.
getInternalError
(
"read len "
+
len
);
...
...
@@ -222,6 +275,11 @@ public class FileStore {
filePos
+=
len
;
}
/**
* Go to the specified file location.
*
* @param pos the location
*/
public
void
seek
(
long
pos
)
throws
SQLException
{
if
(
SysProperties
.
CHECK
&&
pos
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
throw
Message
.
getInternalError
(
"unaligned seek "
+
name
+
" pos "
+
pos
);
...
...
@@ -236,10 +294,24 @@ public class FileStore {
}
}
/**
* Write a number of bytes without encrypting.
*
* @param b the source buffer
* @param off the offset
* @param len the number of bytes to write
*/
protected
void
writeDirect
(
byte
[]
b
,
int
off
,
int
len
)
throws
SQLException
{
write
(
b
,
off
,
len
);
}
/**
* Write a number of bytes.
*
* @param b the source buffer
* @param off the offset
* @param len the number of bytes to write
*/
public
void
write
(
byte
[]
b
,
int
off
,
int
len
)
throws
SQLException
{
if
(
SysProperties
.
CHECK
&&
len
<
0
)
{
throw
Message
.
getInternalError
(
"read len "
+
len
);
...
...
@@ -289,6 +361,11 @@ public class FileStore {
file
.
seek
(
pos
);
}
/**
* Set the length of the file. This will expand or shrink the file.
*
* @param newLength the new file size
*/
public
void
setLength
(
long
newLength
)
throws
SQLException
{
if
(
SysProperties
.
CHECK
&&
newLength
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
throw
Message
.
getInternalError
(
"unaligned setLength "
+
name
+
" pos "
+
newLength
);
...
...
@@ -315,6 +392,11 @@ public class FileStore {
}
}
/**
* Get the file size in bytes.
*
* @return the file size
*/
public
long
length
()
throws
SQLException
{
try
{
long
len
=
fileLength
;
...
...
@@ -336,6 +418,11 @@ public class FileStore {
}
}
/**
* Get the current location of the file pointer.
*
* @return the location
*/
public
long
getFilePointer
()
throws
SQLException
{
if
(
SysProperties
.
CHECK2
)
{
try
{
...
...
@@ -349,6 +436,10 @@ public class FileStore {
return
filePos
;
}
/**
* Call fsync. Depending on the operating system and hardware, this may or
* may not in fact write the changes.
*/
public
void
sync
()
{
try
{
file
.
sync
();
...
...
@@ -357,24 +448,42 @@ public class FileStore {
}
}
/**
* Automatically delete the file once it is no longer in use.
*/
public
void
autoDelete
()
{
autoDeleteReference
=
TempFileDeleter
.
addFile
(
name
,
this
);
}
/**
* No longer automatically delete the file once it is no longer in use.
*/
public
void
stopAutoDelete
()
{
TempFileDeleter
.
stopAutoDelete
(
autoDeleteReference
,
name
);
autoDeleteReference
=
null
;
}
/**
* Check if the file is encrypted.
*
* @return true if it is
*/
public
boolean
isEncrypted
()
{
return
false
;
}
/**
* Close the file. The file may later be re-opened using openFile.
*/
public
void
closeFile
()
throws
IOException
{
file
.
close
();
file
=
null
;
}
/**
* Re-open the file. The file pointer will be reset to the previous
* location.
*/
public
void
openFile
()
throws
IOException
{
if
(
file
==
null
)
{
file
=
FileSystem
.
getInstance
(
name
).
openFileObject
(
name
,
mode
);
...
...
h2/src/main/org/h2/store/Storage.java
浏览文件 @
4ba52d30
...
...
@@ -312,10 +312,6 @@ public class Storage {
file
.
writeBack
(
rec
);
}
public
void
flushFile
()
throws
SQLException
{
file
.
flush
();
}
/**
* Get the overhead to store a record (header data) in number of bytes.
*
...
...
h2/src/main/org/h2/util/ObjectArray.java
浏览文件 @
4ba52d30
...
...
@@ -14,7 +14,7 @@ import org.h2.constant.SysProperties;
/**
* The object array is basically the same as ArrayList.
* It is a bit faster than ArrayList in some
java versions
.
* It is a bit faster than ArrayList in some
versions of Java
.
*/
public
class
ObjectArray
{
private
static
final
int
SIZE_INIT
=
4
,
SIZE_SHRINK
=
256
;
...
...
h2/src/main/org/h2/util/Tool.java
浏览文件 @
4ba52d30
...
...
@@ -16,7 +16,6 @@ import java.sql.SQLException;
public
abstract
class
Tool
{
protected
PrintStream
out
=
System
.
out
;
protected
PrintStream
err
=
System
.
err
;
/**
* Sets the standard output stream.
...
...
h2/src/tools/WEB-INF/web.xml
浏览文件 @
4ba52d30
<?xml version="1.0" encoding="
ISO-8859-1
"?>
<?xml version="1.0" encoding="
UTF-8
"?>
<!--
Copyright 2004-2008 H2 Group.
Multiple-Licensed under the H2 License, Version 1.0,
...
...
h2/src/tools/org/h2/build/doc/MergeDocs.java
浏览文件 @
4ba52d30
...
...
@@ -29,7 +29,7 @@ public class MergeDocs {
// the order of pages is important here
String
[]
pages
=
{
"quickstart.html"
,
"installation.html"
,
"tutorial.html"
,
"features.html"
,
"performance.html"
,
"advanced.html"
,
"grammar.html"
,
"functions.html"
,
"datatypes.html"
,
"build.html"
,
"history.html"
,
"faq.html"
,
"license.html"
};
"history.html"
,
"faq.html"
};
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
pages
.
length
;
i
++)
{
String
fileName
=
pages
[
i
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论