提交 9ae05edd authored 作者: Thomas Mueller's avatar Thomas Mueller

Documentation.

上级 e02fad72
......@@ -76,6 +76,8 @@ Advanced
Setting the Server Bind Address</a><br />
<a href="#file_system">
Pluggable File System</a><br />
<a href="#file_system_split">
Split File System</a><br />
<a href="#database_upgrade">
Database Upgrade</a><br />
<a href="#limits_limitations">
......@@ -1461,6 +1463,25 @@ To read a stream from the classpath, use the prefix <code>classpath:</code>, as
<code>classpath:/org/h2/samples/newsfeed.sql</code>.
</p>
<h2 id="file_system_split">Split File System</h2>
<p>
The file system prefix <code>split:</code> is used to split logical files into multiple physical files,
for example so that a database can get larger than the maximum file system size of the operating system.
If the logical file is larger than the maximum file size, then the file is split as follows:
</p>
<ul><li><code>&lt;fileName&gt;</code> (first block, is always created)
</li><li><code>&lt;fileName&gt;.1.part</code> (second block)
</li></ul>
<p>
More physical files (<code>*.2.part, *.3.part</code>) are automatically created / deleted if needed.
The maximum physical file size of a block is 2^30 bytes, which is also called 1 GiB or 1 GB.
However this can be changed if required, by specifying the block size in the file name.
The file name format is: <code>split:&lt;x&gt;:&lt;fileName&gt;</code> where the file size per block is 2^x.
For 1 MiB block sizes, use x = 20 (because 2^20 is 1 MiB).
The following file name means the logical file is split into 1 MiB blocks: <code>split:20:test.h2.db</code>.
An example database URL for this case is <code>jdbc:h2:split:20:~/test</code>.
</p>
<h2 id="database_upgrade">Database Upgrade</h2>
<p>
In version 1.2, H2 introduced a new file store implementation which is incompatible to the one used in versions &lt; 1.2.
......@@ -1500,11 +1521,11 @@ This database has the following known limitations:
4 TB (using the default page size of 2 KB) or higher (when using a larger page size).
When using the feature "h2.lobInDatabase" then this limit is including CLOB and BLOB data,
otherwise this limit is excluding CLOB and BLOB data, and every CLOB or BLOB can be up to 256 GB.
</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. The database does provide a
workaround for this problem, it is to use the file name prefix <code>split:</code>. In that case files are split into
files of 1 GB by default. An example database URL is:
<code>jdbc:h2:split:~/test</code>.
</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.
The database does provide a workaround for this problem, it is to use the file name prefix <code>split:</code>.
In that case files are split into files of 1 GB by default.
An example database URL is: <code>jdbc:h2:split:~/test</code>.
</li><li>The maximum number of rows per table is 2^64.
</li><li>Main memory requirements: The larger the database, the more main memory is required.
With the version 1.1 storage mechanism, the minimum main memory required for a 12 GB database was around 240 MB.
......
......@@ -1594,12 +1594,26 @@ of the server).
import org.h2.api.Trigger;
...
public class TriggerSample implements Trigger {
public void init(Connection conn, String schemaName, String triggerName,
String tableName, boolean before, int type) {
// initialize the trigger object is necessary
}
public void fire(Connection conn,
Object[] oldRow, Object[] newRow)
throws SQLException {
// the trigger is fired
}
public void close() {
// the database is closed
}
public void remove() {
// the trigger was dropped
}
}
</pre>
<p>
......@@ -1613,6 +1627,24 @@ CREATE TRIGGER INV_INS AFTER INSERT ON INVOICE
<p>
The trigger can be used to veto a change by throwing a <code>SQLException</code>.
</p>
<p>
As an alternative to implementing the <code>Trigger</code> interface,
an application can extend the abstract class <code>org.h2.tools.TriggerAdapter</code>.
This will allows to use the <code>ResultSet</code> interface within trigger implementations.
In this case, only the <code>fire</code> method needs to be implemented:
</p>
<pre>
import org.h2.tools.TriggerAdapter;
...
public class TriggerSample implements TriggerAdapter {
public void fire(Connection conn, ResultSet oldRow, ResultSet newRow)
throws SQLException {
// the trigger is fired
}
}
</pre>
<h2 id="compacting">Compacting a Database</h2>
<p>
......
......@@ -23,6 +23,8 @@ License
H2 License - Version 1.0</a><br />
<a href="#eclipse_license">
Eclipse Public License - Version 1.0</a><br />
<a href="#eccn">
Export Control Classification Number (ECCN)</a><br />
<h2 id="summary">Summary and License FAQ</h2>
<p>
......@@ -719,5 +721,12 @@ than one year after the cause of action arose. Each party waives its rights
to a jury trial in any resulting litigation.
</p>
<h2 id="eccn">Export Control Classification Number (ECCN)</h2>
<p>
As far as we know, the <a href="http://www.bis.doc.gov/licensing/exportingbasics.htm">U.S. Export Control Classification Number (ECCN)</a> for this software is <code>5D002</code>.
However, for legal reasons, we can make no warranty that this information is correct.
For details, see also the <a href="http://www.apache.org/licenses/exports/">Apache Software Foundation Export Classifications page</a>.
</p>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
......@@ -6,7 +6,6 @@
*/
package org.h2.util;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
......
......@@ -77,7 +77,7 @@ public class TriggerSample {
* @param type the operation type: INSERT, UPDATE, or DELETE
*/
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) {
// Initializing trigger
// initialize the trigger object is necessary
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论