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

Documentation.

上级 961b5963
...@@ -3511,7 +3511,7 @@ CALL DATABASE_PATH(); ...@@ -3511,7 +3511,7 @@ CALL DATABASE_PATH();
" "
"Functions (System)","DECODE"," "Functions (System)","DECODE","
DECODE(value, whenValue, thenValue,...) DECODE(value, whenValue, thenValue [,...])
"," ","
Returns the first matching value. NULL is considered to match NULL. Returns the first matching value. NULL is considered to match NULL.
If no match was found, then NULL or the last parameter (if the parameter count is even) is returned. If no match was found, then NULL or the last parameter (if the parameter count is even) is returned.
......
...@@ -848,7 +848,7 @@ against a database that was created with a user name that is not in the script. ...@@ -848,7 +848,7 @@ against a database that was created with a user name that is not in the script.
The <code>Recover</code> tool creates a SQL script from database file. It also processes the transaction log. The <code>Recover</code> tool creates a SQL script from database file. It also processes the transaction log.
</p> </p>
<p> <p>
To verify the database is always recoverable, append <code>;RECOVER_TEST=64</code> To verify the database can recover at any time, append <code>;RECOVER_TEST=64</code>
to the database URL in your test environment. This will simulate an application crash after each 64 writes to the database file. to the database URL in your test environment. This will simulate an application crash after each 64 writes to the database file.
A log file named <code>databaseName.h2.db.log</code> is created that lists the operations. A log file named <code>databaseName.h2.db.log</code> is created that lists the operations.
The recovery is tested using an in-memory file system, that means it may require a larger heap setting. The recovery is tested using an in-memory file system, that means it may require a larger heap setting.
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License, Version 1.0, Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License, Version 1.0,
...@@ -23,14 +22,14 @@ Change Log ...@@ -23,14 +22,14 @@ Change Log
</li><li>Lucene fulltext search: creating an index is now faster if the table already contains data. </li><li>Lucene fulltext search: creating an index is now faster if the table already contains data.
Thanks a lot to Angel Leon from the FrostWire Team for the patch! Thanks a lot to Angel Leon from the FrostWire Team for the patch!
</li><li>Update statements with a column list in brackets did not work if the list only contains one column. </li><li>Update statements with a column list in brackets did not work if the list only contains one column.
Example: update test set (id)=(id). Example: update test set (id)=(id).
</li><li>Read-only databases in a zip file did not work when using the -baseDir option. </li><li>Read-only databases in a zip file did not work when using the -baseDir option.
</li><li>Issue 334: SimpleResultSet.getString now also works for Clob columns. </li><li>Issue 334: SimpleResultSet.getString now also works for Clob columns.
</li><li>Subqueries with an aggregate did not always work. Example: </li><li>Subqueries with an aggregate did not always work. Example:
select (select count(*) from test where a = t.a and b = 0) from test t group by a select (select count(*) from test where a = t.a and b = 0) from test t group by a
</li><li>Server: in some (theoretical) cases, exceptions while closing the connection were swallowed. </li><li>Server: in some (theoretical) cases, exceptions while closing the connection were ignored.
</li><li>Server.createTcpServer, createPgServer, createWebServer: invalid arguments are now detected. </li><li>Server.createTcpServer, createPgServer, createWebServer: invalid arguments are now detected.
</li><li>The selectivity of LOB columns is no longer calculated </li><li>The selectivity of LOB columns is no longer calculated
because indexes on LOB columns are not supported because indexes on LOB columns are not supported
(however this should have little effect on performance, as the selectivity (however this should have little effect on performance, as the selectivity
is calculated from the hash code and not the data). is calculated from the hash code and not the data).
...@@ -38,14 +37,14 @@ Change Log ...@@ -38,14 +37,14 @@ Change Log
when enabled, the database file is only modified when writing to the database. when enabled, the database file is only modified when writing to the database.
When enabled, the serialized file lock is much faster for read-only operations. When enabled, the serialized file lock is much faster for read-only operations.
</li><li>A NullPointerException could occur in TableView.isDeterministic for invalid views. </li><li>A NullPointerException could occur in TableView.isDeterministic for invalid views.
</li><li>Issue 180: when deserializing objects, the context class loader is used </li><li>Issue 180: when deserializing objects, the context class loader is used
instead of the default class loader if the system property "h2.useThreadContextClassLoader" is set. instead of the default class loader if the system property "h2.useThreadContextClassLoader" is set.
Thanks a lot to Noah Fontes for the patch! Thanks a lot to Noah Fontes for the patch!
</li><li>When using the exclusive mode, LOB operations could cause the thread to freeze. </li><li>When using the exclusive mode, LOB operations could cause the thread to block.
This also affected the CreateCluster tool (when using BLOB or CLOB data). This also affected the CreateCluster tool (when using BLOB or CLOB data).
</li><li>The optimization for "group by" was not working correctly if the group by column </li><li>The optimization for "group by" was not working correctly if the group by column
was aliased in the select list. was aliased in the select list.
</li><li>Issue 326: improved support for case sensitive (mixed case) identifiers </li><li>Issue 326: improved support for case sensitive (mixed case) identifiers
without quotes when using DATABASE_TO_UPPER=FALSE. without quotes when using DATABASE_TO_UPPER=FALSE.
</li></ul> </li></ul>
......
...@@ -523,7 +523,7 @@ This is achieved using different database URLs. Settings in the URLs are not cas ...@@ -523,7 +523,7 @@ This is achieved using different database URLs. Settings in the URLs are not cas
<td><a href="#execute_sql_on_connection">Execute SQL on connection</a></td> <td><a href="#execute_sql_on_connection">Execute SQL on connection</a></td>
<td class="notranslate"> <td class="notranslate">
jdbc:h2:&lt;url&gt;;INIT=RUNSCRIPT FROM '~/create.sql'<br /> jdbc:h2:&lt;url&gt;;INIT=RUNSCRIPT FROM '~/create.sql'<br />
jdbc:h2:file:~/sample;INIT=RUNSCRIPT FROM '~/create.sql'\\;RUNSCRIPT FROM '~/populate.sql'<br /> jdbc:h2:file:~/sample;INIT=RUNSCRIPT FROM '~/create.sql'\;RUNSCRIPT FROM '~/populate.sql'<br />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -772,6 +772,13 @@ must be escaped, as in the example below. ...@@ -772,6 +772,13 @@ must be escaped, as in the example below.
<pre> <pre>
String url = "jdbc:h2:mem;INIT=RUNSCRIPT FROM '~/create.sql'\\;RUNSCRIPT FROM '~/populate.sql'"; String url = "jdbc:h2:mem;INIT=RUNSCRIPT FROM '~/create.sql'\\;RUNSCRIPT FROM '~/populate.sql'";
</pre> </pre>
<p>
Please note the double backslash is only required in a Java or properties file.
In a GUI, or in an XML file, only one backslash is required:
</p>
<pre>
&lt;property name="url" value="jdbc:h2:mem:test;INIT=CREATE SCHEMA IF NOT EXISTS TEST\;RUNSCRIPT FROM '~/sql/populate.sql';DB_CLOSE_DELAY=-1" /&gt;
</pre>
<h2 id="ignore_unknown_settings">Ignore Unknown Settings</h2> <h2 id="ignore_unknown_settings">Ignore Unknown Settings</h2>
<p> <p>
...@@ -1190,8 +1197,8 @@ DriverManager.getConnection("jdbc:h2:/data/test;AUTO_SERVER=TRUE"); ...@@ -1190,8 +1197,8 @@ DriverManager.getConnection("jdbc:h2:/data/test;AUTO_SERVER=TRUE");
DriverManager.getConnection("jdbc:h2:/data/test;AUTO_SERVER=TRUE"); DriverManager.getConnection("jdbc:h2:/data/test;AUTO_SERVER=TRUE");
</pre> </pre>
<p> <p>
When using this feature, by default the server allocates a random TCP socket. When using this feature, by default the server uses any free TCP port.
It is possible to control the port that the server uses by passing in an <code>AUTO_SERVER_PORT=9090</code> parameter. The port can be set manually using <code>AUTO_SERVER_PORT=9090</code>.
</p> </p>
<h2 id="page_size">Page Size</h2> <h2 id="page_size">Page Size</h2>
......
...@@ -97,7 +97,7 @@ spread the word, and translated this project. Also many thanks to the donors: ...@@ -97,7 +97,7 @@ spread the word, and translated this project. Also many thanks to the donors:
</li><li><a href="http://skycash.com">SkyCash, Poland</a> </li><li><a href="http://skycash.com">SkyCash, Poland</a>
</li><li><a href="http://lumber-mill.co.jp">Lumber-mill, Inc., Japan</a> </li><li><a href="http://lumber-mill.co.jp">Lumber-mill, Inc., Japan</a>
</li><li><a href="http://www.stockmarketeye.com">StockMarketEye, USA</a> </li><li><a href="http://www.stockmarketeye.com">StockMarketEye, USA</a>
</li><li>Alessio Jacopo D'Adamo, Italy</a> </li><li>Alessio Jacopo D'Adamo, Italy
</li><li>Martin Wildam, Austria </li><li>Martin Wildam, Austria
</li><li>Ashwin Jayaprakash, USA </li><li>Ashwin Jayaprakash, USA
</li><li>Donald Bleyl, USA </li><li>Donald Bleyl, USA
......
...@@ -51,11 +51,10 @@ Please note he is not one of the developers of H2. He describes himself as follo ...@@ -51,11 +51,10 @@ Please note he is not one of the developers of H2. He describes himself as follo
<p> <p>
<a href="http://groups.google.com/group/h2-database/browse_thread/thread/adee024b8af85931/1edbc4a601146ec6"> <a href="http://groups.google.com/group/h2-database/browse_thread/thread/adee024b8af85931/1edbc4a601146ec6">
Quote</a>: Quote</a>:
"This is by far the easiest and fastest database that I have ever used. "This is by far the easiest and fastest database that I have ever used.
Originally the web application that I am working on is using SQL server. Originally the web application that I am working on is using SQL server.
But, in less than 15 minutes I had H2 up and working with little recoding of the SQL. But, in less than 15 minutes I had H2 up and working with little recoding of the SQL.
Thanks..... " Thanks..... "
</a>
</p> </p>
http://groups.google.com/group/h2-database/browse_thread/thread/f4b19dfe31efcbe7/32c07dce1bd5a7a5 http://groups.google.com/group/h2-database/browse_thread/thread/f4b19dfe31efcbe7/32c07dce1bd5a7a5
......
...@@ -562,8 +562,10 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -562,8 +562,10 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>MySQL compatibility: index names only need to be unique for the given table. </li><li>MySQL compatibility: index names only need to be unique for the given table.
</li><li>Issue 352: constraints: distinguish between 'no action' and 'restrict'. Currently, only restrict is supported, </li><li>Issue 352: constraints: distinguish between 'no action' and 'restrict'. Currently, only restrict is supported,
and 'no action' is internally mapped to 'restrict'. The database meta data returns 'restrict' in all cases. and 'no action' is internally mapped to 'restrict'. The database meta data returns 'restrict' in all cases.
</li><li>Oracle compatilibity: support MEDIAN aggregate function. </li><li>Oracle compatibility: support MEDIAN aggregate function.
</li><li>Issue 348: Oracle compatilibity: division should return a decimal result. </li><li>Issue 348: Oracle compatibility: division should return a decimal result.
</li><li>Read rows on demand: instead of reading the whole row, only read up to that column that is requested.
Keep an pointer to the data area and the column id that is already read.
</li></ul> </li></ul>
<h2>Not Planned</h2> <h2>Not Planned</h2>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -234,10 +234,10 @@ public class SysProperties { ...@@ -234,10 +234,10 @@ public class SysProperties {
/** /**
* System property <code>h2.modifyOnWrite</code> (default: false).<br /> * System property <code>h2.modifyOnWrite</code> (default: false).<br />
* Only modify the database file when writing to the database. If disabled, * Only modify the database file when recovery is necessary, or when writing
* opening the database modifies the file (to prepare it for writing). * to the database. If disabled, opening the database always writes to the
* This only occurs when no recovery is necessary. * file (except if the database is read-only). When enabled, the serialized
* When enabled, the serialized file lock is faster. * file lock is faster.
*/ */
public static final boolean MODIFY_ON_WRITE = Utils.getProperty("h2.modifyOnWrite", false); public static final boolean MODIFY_ON_WRITE = Utils.getProperty("h2.modifyOnWrite", false);
...@@ -387,11 +387,13 @@ public class SysProperties { ...@@ -387,11 +387,13 @@ public class SysProperties {
public static final String URL_MAP = Utils.getProperty("h2.urlMap", null); public static final String URL_MAP = Utils.getProperty("h2.urlMap", null);
/** /**
* System property <code>h2.useThreadContextClassLoader</code> (default: false).<br /> * System property <code>h2.useThreadContextClassLoader</code>
* Instead of using the default class loader when deserializing objects, * (default: false).<br />
* the current thread-context class loader will be used. * Instead of using the default class loader when deserializing objects, the
* current thread-context class loader will be used.
*/ */
public static final boolean USE_THREAD_CONTEXT_CLASS_LOADER = Utils.getProperty("h2.useThreadContextClassLoader", false); public static final boolean USE_THREAD_CONTEXT_CLASS_LOADER =
Utils.getProperty("h2.useThreadContextClassLoader", false);
/** /**
* System property <code>h2.webMaxValueLength</code> (default: 100000).<br /> * System property <code>h2.webMaxValueLength</code> (default: 100000).<br />
......
...@@ -2374,12 +2374,27 @@ public class Database implements DataHandler { ...@@ -2374,12 +2374,27 @@ public class Database implements DataHandler {
return dbSettings; return dbSettings;
} }
/**
* Create a new hash map. Depending on the configuration, the key is case
* sensitive or case insensitive.
*
* @param <V> the value type
* @return the hash map
*/
public <V> HashMap<String, V> newStringMap() { public <V> HashMap<String, V> newStringMap() {
return dbSettings.databaseToUpper ? return dbSettings.databaseToUpper ?
new HashMap<String, V>() : new HashMap<String, V>() :
new CaseInsensitiveMap<V>(); new CaseInsensitiveMap<V>();
} }
/**
* Compare two identifiers (table names, column names,...) and verify they
* are equal. Case sensitivity depends on the configuration.
*
* @param a the first identifier
* @param b the second identifier
* @return true if they match
*/
public boolean equalsIdentifiers(String a, String b) { public boolean equalsIdentifiers(String a, String b) {
if (a == b || a.equals(b)) { if (a == b || a.equals(b)) {
return true; return true;
......
...@@ -577,7 +577,10 @@ public class FullTextLucene extends FullText { ...@@ -577,7 +577,10 @@ public class FullTextLucene extends FullText {
// ignore // ignore
} }
public void commitIndex() throws SQLException { /**
* Commit all changes to the Lucene index.
*/
void commitIndex() throws SQLException {
try { try {
indexAccess.writer.commit(); indexAccess.writer.commit();
// recreate Searcher with the IndexWriter's reader. // recreate Searcher with the IndexWriter's reader.
...@@ -595,6 +598,7 @@ public class FullTextLucene extends FullText { ...@@ -595,6 +598,7 @@ public class FullTextLucene extends FullText {
* Add a row to the index. * Add a row to the index.
* *
* @param row the row * @param row the row
* @param commitIndex whether to commit the changes to the Lucene index
*/ */
protected void insert(Object[] row, boolean commitIndex) throws SQLException { protected void insert(Object[] row, boolean commitIndex) throws SQLException {
/*## LUCENE2 ## /*## LUCENE2 ##
......
...@@ -1275,6 +1275,10 @@ Returns the name of the database." ...@@ -1275,6 +1275,10 @@ Returns the name of the database."
DATABASE_PATH() DATABASE_PATH()
"," ","
Returns the directory of the database files and the database name, if it is file based." Returns the directory of the database files and the database name, if it is file based."
"Functions (System)","DECODE","
DECODE(value, whenValue, thenValue [,...])
","
Returns the first matching value."
"Functions (System)","FILE_READ"," "Functions (System)","FILE_READ","
FILE_READ(fileNameString [,encodingString]) FILE_READ(fileNameString [,encodingString])
"," ","
......
...@@ -578,8 +578,4 @@ public class Schema extends DbObjectBase { ...@@ -578,8 +578,4 @@ public class Schema extends DbObjectBase {
} }
} }
public <V> HashMap<String, V> newStringMap() {
return database.newStringMap();
}
} }
...@@ -107,7 +107,7 @@ public abstract class Table extends SchemaObjectBase { ...@@ -107,7 +107,7 @@ public abstract class Table extends SchemaObjectBase {
private Row nullRow; private Row nullRow;
public Table(Schema schema, int id, String name, boolean persistIndexes, boolean persistData) { public Table(Schema schema, int id, String name, boolean persistIndexes, boolean persistData) {
columnMap = schema.newStringMap(); columnMap = schema.getDatabase().newStringMap();
initSchemaObjectBase(schema, id, name, Trace.TABLE); initSchemaObjectBase(schema, id, name, Trace.TABLE);
this.persistIndexes = persistIndexes; this.persistIndexes = persistIndexes;
this.persistData = persistData; this.persistData = persistData;
......
...@@ -46,7 +46,12 @@ public class NetUtils { ...@@ -46,7 +46,12 @@ public class NetUtils {
if (address == null) { if (address == null) {
address = InetAddress.getLocalHost(); address = InetAddress.getLocalHost();
} }
return createSocket(getHostAddress(address), port, ssl); int test;
// try {
// return createSocket(getHostAddress(address), port, ssl);
// } catch (IOException e) {
return createSocket("localhost", port, ssl);
// }
} }
/** /**
......
...@@ -343,7 +343,7 @@ java org.h2.test.TestAll timer ...@@ -343,7 +343,7 @@ java org.h2.test.TestAll timer
System.setProperty("h2.useThreadContextClassLoader", "true"); System.setProperty("h2.useThreadContextClassLoader", "true");
int testing; int testing;
System.setProperty("h2.modifyOnWrite", "true"); // System.setProperty("h2.modifyOnWrite", "true");
// System.setProperty("h2.storeLocalTime", "true"); // System.setProperty("h2.storeLocalTime", "true");
......
...@@ -35,10 +35,8 @@ public class TestAutoServer extends TestBase { ...@@ -35,10 +35,8 @@ public class TestAutoServer extends TestBase {
public void test() throws Exception { public void test() throws Exception {
testUnsupportedCombinations(); testUnsupportedCombinations();
testAutoServer(false); testAutoServer(false);
testAutoServer(true);
if (!config.big) { if (!config.big) {
int todo; testAutoServer(true);
// testAutoServer(true);
} }
testLinkedLocalTablesWithAutoServerReconnect(); testLinkedLocalTablesWithAutoServerReconnect();
} }
......
...@@ -12,14 +12,18 @@ import org.h2.util.StringUtils; ...@@ -12,14 +12,18 @@ import org.h2.util.StringUtils;
import org.h2.util.Utils; import org.h2.util.Utils;
/** /**
* Tests the ability to deserialize objects that are not part of the system class- * Tests the ability to deserialize objects that are not part of the system
* loading scope. * class-loading scope.
*/ */
public class TestObjectDeserialization extends TestBase { public class TestObjectDeserialization extends TestBase {
private static final String CLAZZ = "org.h2.test.unit.SampleObject"; private static final String CLAZZ = "org.h2.test.unit.SampleObject";
private static final String OBJECT = "aced00057372001d6f72672e68322e746573742e756e69742e53616d706c654f626a65637400000000000000010200007870"; private static final String OBJECT =
"aced00057372001d6f72672e68322e746573742e756e69742e53616d706c654f626a65637400000000000000010200007870";
/**
* The thread context class loader was used.
*/
protected boolean usesThreadContextClassLoader; protected boolean usesThreadContextClassLoader;
/** /**
...@@ -37,6 +41,7 @@ public class TestObjectDeserialization extends TestBase { ...@@ -37,6 +41,7 @@ public class TestObjectDeserialization extends TestBase {
} }
private void testThreadContextClassLoader() throws Exception { private void testThreadContextClassLoader() throws Exception {
usesThreadContextClassLoader = false;
Thread.currentThread().setContextClassLoader(new TestClassLoader()); Thread.currentThread().setContextClassLoader(new TestClassLoader());
try { try {
Utils.deserialize(StringUtils.convertHexToBytes(OBJECT)); Utils.deserialize(StringUtils.convertHexToBytes(OBJECT));
......
...@@ -693,5 +693,6 @@ enhancer banana nit cglib challenging intercepted banane assertthrows ...@@ -693,5 +693,6 @@ enhancer banana nit cglib challenging intercepted banane assertthrows
objenesis prepend detecting overridable eater forgetting tear objenesis prepend detecting overridable eater forgetting tear
fork tester jaspa redirection johnny brings gone jooq iciql offline pdo mappings largely fork tester jaspa redirection johnny brings gone jooq iciql offline pdo mappings largely
pst patadia summertime jalpesh scheme compilable ski takanori dsts kawashima pst patadia summertime jalpesh scheme compilable ski takanori dsts kawashima
kokoci seldom jaros ciphers srcs kokoci seldom jaros ciphers srcs invectorate noah nfontes fontes recoding
minecraft videos youtube dataflyer bukkit alessio adamo jacopo angel leon frost
deserializing
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论