提交 c7c8e5d2 authored 作者: Thomas Mueller's avatar Thomas Mueller

Documentation.

上级 03ac90bd
......@@ -334,6 +334,7 @@ ALTER USER SA SET PASSWORD 'rioyxlgt'
ALTER VIEW viewName RECOMPILE
","
Recompiles a view after the underlying tables have been changed or created.
This command is used for views created using CREATE FORCE VIEW.
This command commits an open transaction.
","
ALTER VIEW ADDRESS_VIEW RECOMPILE
......@@ -713,6 +714,7 @@ DROP TABLE [ IF EXISTS ] tableName [,...]
","
Drops an existing table, or a list of existing tables.
This command commits an open transaction.
This will also drop all views that depend on this table.
","
DROP TABLE TEST
"
......@@ -743,6 +745,7 @@ DROP VIEW [ IF EXISTS ] viewName
","
Drops a view.
This command commits an open transaction.
This will also drop all views that depend on this view.
","
DROP VIEW TEST_VIEW
"
......
......@@ -767,9 +767,12 @@ The <code>Recover</code> tool creates a SQL script from database file. It also p
<h2 id="file_locking_protocols">File Locking Protocols</h2>
<p>
Whenever a database is opened, a lock file is created to signal other processes
that the database is in use. If the database is closed, or if the process that opened
the database terminates, this lock file is deleted.
Multiple concurrent connections to the same database are supported, however a database file
can only be open for reading and writing (in embedded mode) by one process at the same time.
Otherwise, the processes would overwrite each others data and corrupt the database file.
To protect against this problem, whenever a database is opened, a lock file is created
to signal other processes that the database is in use. If the database is closed, or if the process that opened
the database stops normally, this lock file is deleted.
</p><p>
In special cases (if the process did not terminate normally, for example because
there was a power failure), the lock file is not deleted by the process that created it.
......
......@@ -49,24 +49,24 @@ For Java 1.4, the jar file needs to be converted first using
<h2 id="environment">Environment</h2>
<p>
A Java Runtime Environment (JRE) version 1.5 or higher is required to run this database.
To run this database, a Java Runtime Environment (JRE) version 1.5 or higher is required.
</p>
<p>
To build the database executables, the following software stack was used.
Newer version or compatible software works too.
To create the database executables, the following software stack was used.
To use this database, it is not required to install this software however.
</p>
<ul><li>Mac OS X and Windows XP
</li><li><a href="http://java.sun.com/javase/downloads">Sun JDK Version 1.5 and 1.6</a>
</li><li><a href="http://www.eclipse.org">Eclipse Version 3.4</a>
</li><li>Eclipse Plugins:
<a href="http://subclipse.tigris.org">Subclipse 1.4.6</a>,
<a href="http://eclipse-cs.sourceforge.net">Eclipse Checkstyle Plug-in 4.4.2</a>,
<a href="http://subclipse.tigris.org">Subclipse</a>,
<a href="http://eclipse-cs.sourceforge.net">Eclipse Checkstyle Plug-in</a>,
<a href="http://www.eclemma.org">EclEmma Java Code Coverage 1.3.0</a>
</li><li><a href="http://emma.sourceforge.net">Emma Java Code Coverage</a>
</li><li><a href="http://www.mozilla.com/firefox">Mozilla Firefox 3.0</a>
</li><li><a href="http://www.openoffice.org">OpenOffice 3.0</a>
</li><li><a href="http://www.mozilla.com/firefox">Mozilla Firefox</a>
</li><li><a href="http://www.openoffice.org">OpenOffice</a>
</li><li><a href="http://nsis.sourceforge.net">NSIS 2.38</a> (Nullsoft Scriptable Install System)
</li><li><a href="http://maven.apache.org">Maven 2.0.9</a>
</li><li><a href="http://maven.apache.org">Maven</a>
</li></ul>
<h2 id="building">Building the Software</h2>
......
......@@ -1069,7 +1069,9 @@ or the SQL statement <code>SET MODE MySQL</code>.
and <code>NULL</code> is inserted,
then a 0 (or empty string, or the current timestamp for timestamp columns) value is used.
Usually, this operation is not allowed and an exception is thrown.
</li><li>Creating indexes in the <code>CREATE TABLE</code> statement is allowed.
</li><li>Creating indexes in the <code>CREATE TABLE</code> statement is allowed using
<code>INDEX(..)</code> or <code>KEY(..)</code>.
Example: <code>create table test(id int primary key, name varchar(255), key idx_name(name));</code>
</li><li>Meta data calls return identifiers in lower case.
</li><li>When converting a floating point number to an integer, the fractional
digits are not truncated, but the value is rounded.
......
......@@ -494,6 +494,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
which is implemented in Function.java).
</li><li>Improve documentation of system properties: only list the property names, default values, and description.
</li><li>Support running totals / cumulative sum using SUM(..) OVER(..).
</li><li>Improve object memory size calculation. Use constants for known VMs, or use reflection to call java.lang.instrument.Instrumentation.getObjectSize(Object objectToSize)
</li></ul>
<h2>Not Planned</h2>
......
......@@ -51,7 +51,10 @@ public class Mode {
public boolean convertOnlyToSmallerScale;
/**
* Creating indexes in the CREATE TABLE statement is allowed.
* Creating indexes in the CREATE TABLE statement is allowed using
* <code>INDEX(..)</code> or <code>KEY(..)</code>.
* Example: <code>create table test(id int primary key, name varchar(255),
* key idx_name(name));</code>
*/
public boolean indexDefinitionInCreateTable;
......
......@@ -7,6 +7,8 @@ package org.h2.test.todo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.tools.DeleteDbFiles;
......@@ -23,6 +25,17 @@ public class TestUndoLogMemory {
public static void main(String... args) throws Exception {
System.setProperty("h2.largeTransactions", "true");
int todoLargeRows;
new TestUndoLogMemory().test(10, "null");
new TestUndoLogMemory().test(100, "space(100000)");
// new TestUndoLogMemory().test(100000, "null");
// new TestUndoLogMemory().test(1000, "space(100000)");
}
private void test(int count, String defaultValue) throws SQLException {
// -Xmx1m -XX:+HeapDumpOnOutOfMemoryError
DeleteDbFiles.execute("data", "test", true);
Connection conn = DriverManager.getConnection("jdbc:h2:data/test");
......@@ -30,28 +43,39 @@ public class TestUndoLogMemory {
stat.execute("set cache_size 32");
stat.execute("SET max_operation_memory 100");
stat.execute("SET max_memory_undo 100");
conn.setAutoCommit(false);
// also a problem: tables without unique index
stat.execute("create table test(id int)");
stat.execute("insert into test select x from system_range(1, 100000)");
System.out.println("create--- " + count + " " + defaultValue);
stat.execute("create table test(id int, name varchar default " + defaultValue + " )");
System.out.println("insert---");
stat.execute("insert into test(id) select x from system_range(1, "+count+")");
System.out.println("rollback---");
conn.rollback();
System.out.println("drop---");
stat.execute("drop table test");
stat.execute("create table test(id int primary key)");
System.out.println("create---");
stat.execute("create table test(id int primary key, name varchar default " + defaultValue + " )");
// INSERT problem
System.out.println("insert---");
stat.execute(
"insert into test select x from system_range(1, 400000)");
"insert into test(id) select x from system_range(1, "+count+")");
System.out.println("delete---");
stat.execute("delete from test");
// DELETE problem
stat.execute(
"insert into test select x from system_range(1, 50000)");
stat.execute(
"insert into test select x from system_range(50001, 100000)");
stat.execute(
"insert into test select x from system_range(100001, 150000)");
System.out.println("insert---");
PreparedStatement prep = conn.prepareStatement("insert into test(id) values(?)");
for (int i = 0; i < count; i++) {
prep.setInt(1, i);
prep.execute();
}
System.out.println("delete---");
stat.execute("delete from test");
System.out.println("close---");
conn.close();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论