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

Documentation.

上级 9b0bd1b3
......@@ -3396,6 +3396,9 @@ Instead of a file, an URL may be used, for example
""jar:file:///c:/temp/example.zip!/org/example/nested.csv"".
To read a stream from the classpath, use the prefix ""classpath:"".
For performance reason, CSVREAD should not be used inside a join.
Instead, import the data first (possibly into a temporary table) and then use the table.
Admin rights are required to execute this command.
","
CALL CSVREAD('test.csv');
......
......@@ -1475,9 +1475,9 @@ If the logical file is larger than the maximum file size, then the file is split
<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).
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>
......@@ -1506,10 +1506,13 @@ prior opening a database connection.
</p>
<p>
Since version 1.2.140 it is possible to let the old h2 classes (v 1.2.128) connect to the database.
The automatic upgrade .jar file must be present, and the URL must start with <code>jdbc:h2v1_1:</code>.
The automatic upgrade .jar file must be present, and the URL must start with <code>jdbc:h2v1_1:</code>
(the JDBC driver class is <code>org.h2.upgrade.v1_1.Driver</code>).
If the database should automatically connect using the old version if a database with the old format exists
(without upgrade), and use the new version otherwise, then append <code>;NO_UPGRADE=TRUE</code>
to the database URL.
Please note the old driver did not process the system property <code>"h2.baseDir"</code> correctly,
so that using this setting is not supported when upgrading.
</p>
<h2 id="limits_limitations">Limits and Limitations</h2>
......
......@@ -37,7 +37,7 @@ Change Log
08004 instead of 28000, which resulted in the wrong error message.
</li><li>In some cases, creating a new table or altering an existing table threw the exception:
Unique index or primary key violation: "PRIMARY KEY ON """".PAGE_INDEX".
</li><li>The Shell tool no longer supports the built-in command "show",
</li><li>The Shell tool no longer supports the built-in command "show",
because it is a legal SQL statement for H2 and MySQL.
However, the "describe" command is still supported, and now lists all tables
if called without parameter.
......@@ -45,13 +45,13 @@ Change Log
did not work for not-persisted tables in a persisted database.
It threw a ClassCastException.
</li><li>Issue 308: Statement.getGeneratedKeys() now returns an empty result set if no key was generated.
</li><li>The h2small.jar (created with build jarSmall) included the Android API.
</li><li>The h2small.jar (created with build jarSmall) included the Android API.
This has been removed, shrinking the jar file by 21 KB.
</li><li>When creating a table, the precision must now be at least as large as the scale.
</li><li>Support for Java 1.3 and Java 1.4 has been removed.
</li><li>Improved error message for syntax error: the list of expected tokens was sometimes not set correctly.
</li><li>Database file growth can now be limited using the database setting PAGE_STORE_MAX_GROWTH.
Slower growth may slow down operation, but speed up closing database.
Slower growth may slow down operation, but speed up closing database.
</li></ul>
<h2>Version 1.3.154 (2011-04-04)</h2>
......
......@@ -1080,8 +1080,8 @@ or the SQL statement <code>SET MODE MySQL</code>.
</li></ul>
<p>
Text comparison in MySQL is case insensitive by default, while in H2 it is case sensitive (as in most other databases).
H2 does support case insensitive text comparison, but it needs to be set separately,
using <code>SET IGNORECASE TRUE</code>.
H2 does support case insensitive text comparison, but it needs to be set separately,
using <code>SET IGNORECASE TRUE</code>.
This affects comparison using <code>=, LIKE, REGEXP</code>.
</p>
......@@ -1146,7 +1146,8 @@ jdbc:h2:/data/test;AUTO_SERVER=TRUE
Use the same URL for all connections to this database. Internally, when using this mode,
the first connection to the database is made in embedded mode, and additionally a server
is started internally (as a daemon thread). If the database is already open in another process,
the server mode is used automatically.
the server mode is used automatically. The IP address and port of the server are stored in the file
<code>.lock.db</code>, that's why in-memory databases can't be supported.
</p>
<p>
The application that opens the first connection to the database uses the embedded mode,
......@@ -1613,13 +1614,13 @@ public class TriggerSample implements Trigger {
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
}
......@@ -1627,7 +1628,7 @@ public class TriggerSample implements Trigger {
public void remove() {
// the trigger was dropped
}
}
</pre>
<p>
......@@ -1652,7 +1653,7 @@ import org.h2.tools.TriggerAdapter;
...
public class TriggerSample implements TriggerAdapter {
public void fire(Connection conn, ResultSet oldRow, ResultSet newRow)
public void fire(Connection conn, ResultSet oldRow, ResultSet newRow)
throws SQLException {
// the trigger is fired
}
......
......@@ -679,8 +679,8 @@ TEST.TEST_DATA read: 85 (100%)
*/
</pre>
<p>
The cache will prevent the pages are read twice. H2 reads all columns of the row
unless only the columns in the index are read. Except for large CLOB and BLOB, which are not store in the table.
The cache will prevent the pages are read twice. H2 reads all columns of the row
unless only the columns in the index are read. Except for large CLOB and BLOB, which are not store in the table.
</p>
<h3>Special Optimizations</h3>
......
......@@ -417,6 +417,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>User defined functions: allow to store the bytecode (of just the class, or the jar file of the extension) in the database.
</li><li>Compatibility: ResultSet.getObject() on a CLOB (TEXT) should return String for PostgreSQL and MySQL.
</li><li>Optimizer: WHERE X=? AND Y IN(?), it always uses the index on Y. Should be cost based.
</li><li>Common Table Expression (CTE) / recursive queries: support parameters. Issue 314.
</li><li>Oracle compatibility: support INSERT ALL.
</li><li>Issue 178: Optimizer: index usage when both ascending and descending indexes are available.
</li><li>Issue 179: Related subqueries in HAVING clause.
......@@ -454,7 +455,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Common Table Expression (CTE) / recursive queries: avoid endless loop. Issue 218.
</li><li>Common Table Expression (CTE) / recursive queries: support multiple named queries. Issue 220.
</li><li>Common Table Expression (CTE) / recursive queries: identifier scope may be incorrect. Issue 222.
</li><li>Common Table Expression (CTE) / recursive queries: support parameters.
</li><li>Log long running transactions (similar to long running statements).
</li><li>Parameter data type is data type of other operand. Issue 205.
</li><li>Some combinations of nested join with right outer join are not supported.
......
......@@ -795,6 +795,11 @@ A CSV file can be read using the function <code>CSVREAD</code>. Example:
<pre>
SELECT * FROM CSVREAD('test.csv');
</pre>
<p>
Please note for performance reason, <code>CSVREAD</code> should not be used inside a join.
Instead, import the data first (possibly into a temporary table), create the required indexes
if necessary, and then query this table.
</p>
<h3>Importing Data from a CSV File</h3>
<p>
......@@ -1270,7 +1275,7 @@ The <code>destroy-method</code> will help prevent exceptions on hot-redeployment
<h3>Error Code Incompatibility</h3>
<p>
There is an incompatibility with the Spring JdbcTemplate and H2 version 1.3.154 and newer,
because of a change in the error code. This will cause the JdbcTemplate to not detect
because of a change in the error code. This will cause the JdbcTemplate to not detect
a duplicate key condition, and so a <code>DataIntegrityViolationException</code> is thrown instead of
<code>DuplicateKeyException</code>.
See also <a href="https://jira.springsource.org/browse/SPR-8235">the issue SPR-8235</a>.
......@@ -1285,7 +1290,7 @@ The workaround is to add the following XML file to the root of the classpath:
http://www.springframework.org/schema/beans/spring-beans.xsd"
&gt;
&lt;import resource="classpath:org/springframework/jdbc/support/sql-error-codes.xml"/&gt;
&lt;bean id="H2" class="org.springframework.jdbc.support.SQLErrorCodes"&gt;
&lt;bean id = "H2" class="org.springframework.jdbc.support.SQLErrorCodes"&gt;
&lt;property name="badSqlGrammarCodes"&gt;
&lt;value&gt;
42000,42001,42101,42102,42111,42112,42121,42122,42132
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -246,7 +246,7 @@ public class DbSettings extends SettingsBase {
public final boolean optimizeUpdate = get("OPTIMIZE_UPDATE", true);
/**
* Database setting <code>PAGE_STORE_MAX_GROWTH_RATE</code>
* Database setting <code>PAGE_STORE_MAX_GROWTH</code>
* (default: Integer.MAX_VALUE).<br />
* The maximum number of pages the file grows at any time.
*/
......
......@@ -761,7 +761,7 @@ public class Function extends Expression implements FunctionCall {
if (v0 == ValueNull.INSTANCE) {
expr = argList[2];
} else {
expr = argList[1];
expr = argList[1];
}
Value v = expr.getValue(session);
result = v.convertTo(dataType);
......
......@@ -192,7 +192,7 @@ CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ] name
{ { ( { columnDefinition | constraint } [,...] ) [ AS select ] }
| { AS select } }
[ ENGINE tableEngineName ] [ TRANSACTIONAL ] [ NOT PERSISTENT ]
[ ENGINE tableEngineName ] [ NOT PERSISTENT ] [ TRANSACTIONAL ]
","
Creates a new table."
"Commands (DDL)","CREATE TRIGGER","
......@@ -892,7 +892,7 @@ MOD(long, long)
","
The modulo operation."
"Functions (Numeric)","CEILING","
CEILING(double)
{ CEILING | CEIL } (double)
","
See also Java ""Math."
"Functions (Numeric)","DEGREES","
......@@ -908,7 +908,7 @@ FLOOR(double)
","
See also Java ""Math."
"Functions (Numeric)","LOG","
LOG(double)
{ LOG | LN } (double)
","
See also Java ""Math."
"Functions (Numeric)","LOG10","
......@@ -932,7 +932,7 @@ POWER(double, double)
","
See also Java ""Math."
"Functions (Numeric)","RAND","
RAND( [ int ] )
{ RAND | RANDOM } ( [ int ] )
","
Calling the function without parameter returns the next a pseudo random number."
"Functions (Numeric)","RANDOM_UUID","
......@@ -1244,7 +1244,7 @@ CAST(value AS dataType)
","
Converts a value to another data type."
"Functions (System)","COALESCE","
COALESCE(aValue, bValue [,...])
{ COALESCE | NVL } (aValue, bValue [,...])
","
Returns the first value that is not null."
"Functions (System)","CONVERT","
......@@ -1321,6 +1321,10 @@ Returns the next value of the sequence."
NULLIF(aValue, bValue)
","
Returns NULL if 'a' is equals to 'b', otherwise 'a'."
"Functions (System)","NVL2","
NVL2(testValue, aValue, bValue)
","
If the test value is null, then 'b' is returned."
"Functions (System)","READONLY","
READONLY()
","
......
......@@ -175,6 +175,13 @@ public class LobStorage {
return ValueLob.createSmallLob(type, small);
}
/**
* Read a block of data from the given LOB.
*
* @param lob the lob id
* @param seq the block sequence number
* @return the block (expanded if stored compressed)
*/
byte[] readBlock(long lob, int seq) throws SQLException {
synchronized (handler) {
String sql = "SELECT COMPRESSED, DATA FROM " + LOB_MAP + " M " +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论