提交 819b8f57 authored 作者: andrei's avatar andrei

Merge remote-tracking branch 'h2database/master' into non_blocking

...@@ -227,9 +227,8 @@ SHOW TABLES ...@@ -227,9 +227,8 @@ SHOW TABLES
" "
"Commands (DML)","WITH"," "Commands (DML)","WITH","
WITH [ RECURSIVE ] { name [( columnName [,...] )] WITH [ RECURSIVE ] { name [( columnName [,...] )] AS ( select ) [,...] }
AS ( select ) [,...] } { select | insert | update | merge | delete | createTable }
{ select | insert | update | merge | delete | createTable }
"," ","
Can be used to create a recursive or non-recursive query (common table expression). Can be used to create a recursive or non-recursive query (common table expression).
For recursive queries the first select has to be a UNION. For recursive queries the first select has to be a UNION.
...@@ -373,13 +372,14 @@ ALTER TABLE TEST ALTER COLUMN NAME SET INVISIBLE; ...@@ -373,13 +372,14 @@ ALTER TABLE TEST ALTER COLUMN NAME SET INVISIBLE;
"Commands (DDL)","ALTER TABLE DROP COLUMN"," "Commands (DDL)","ALTER TABLE DROP COLUMN","
ALTER TABLE [ IF EXISTS ] tableName DROP COLUMN [ IF EXISTS ] ALTER TABLE [ IF EXISTS ] tableName DROP COLUMN [ IF EXISTS ]
( columnName [,...] ) columnName [,...] | ( columnName [,...] )
"," ","
Removes column(s) from a table. Removes column(s) from a table.
This command commits an open transaction in this connection. This command commits an open transaction in this connection.
"," ","
ALTER TABLE TEST DROP COLUMN NAME ALTER TABLE TEST DROP COLUMN NAME
ALTER TABLE TEST DROP COLUMN NAME1, NAME2 ALTER TABLE TEST DROP COLUMN NAME1, NAME2
ALTER TABLE TEST DROP COLUMN (NAME1, NAME2)
" "
"Commands (DDL)","ALTER TABLE DROP CONSTRAINT"," "Commands (DDL)","ALTER TABLE DROP CONSTRAINT","
...@@ -394,7 +394,7 @@ ALTER TABLE TEST DROP CONSTRAINT UNIQUE_NAME ...@@ -394,7 +394,7 @@ ALTER TABLE TEST DROP CONSTRAINT UNIQUE_NAME
"Commands (DDL)","ALTER TABLE SET"," "Commands (DDL)","ALTER TABLE SET","
ALTER TABLE [ IF EXISTS ] tableName SET REFERENTIAL_INTEGRITY ALTER TABLE [ IF EXISTS ] tableName SET REFERENTIAL_INTEGRITY
{ FALSE | TRUE [ CHECK | NOCHECK ] } { FALSE | TRUE } [ CHECK | NOCHECK ]
"," ","
Disables or enables referential integrity checking for a table. This command can Disables or enables referential integrity checking for a table. This command can
be used inside a transaction. Enabling referential integrity does not check be used inside a transaction. Enabling referential integrity does not check
...@@ -3260,7 +3260,7 @@ LOG(A) ...@@ -3260,7 +3260,7 @@ LOG(A)
"Functions (Numeric)","LOG10"," "Functions (Numeric)","LOG10","
LOG10(numeric) LOG10(numeric)
"," ","
See also Java ""Math.log10"" (in Java 5). See also Java ""Math.log10"".
This method returns a double. This method returns a double.
"," ","
LOG10(A) LOG10(A)
...@@ -3895,7 +3895,7 @@ CURRENT_TIMESTAMP() ...@@ -3895,7 +3895,7 @@ CURRENT_TIMESTAMP()
"Functions (Time and Date)","DATEADD"," "Functions (Time and Date)","DATEADD","
{ DATEADD| TIMESTAMPADD } (datetimeField, addIntLong, dateAndTime) { DATEADD| TIMESTAMPADD } (datetimeField, addIntLong, dateAndTime)
"," ","
Adds units to a date-time value. The string indicates the unit. Adds units to a date-time value. The datetimeField indicates the unit.
Use negative values to subtract units. Use negative values to subtract units.
addIntLong may be a long value when manipulating milliseconds, addIntLong may be a long value when manipulating milliseconds,
microseconds, or nanoseconds otherwise its range is restricted to int. microseconds, or nanoseconds otherwise its range is restricted to int.
...@@ -3912,7 +3912,7 @@ DATEADD('MONTH', 1, DATE '2001-01-31') ...@@ -3912,7 +3912,7 @@ DATEADD('MONTH', 1, DATE '2001-01-31')
"," ","
Returns the the number of crossed unit boundaries between two date/time values. Returns the the number of crossed unit boundaries between two date/time values.
This method returns a long. This method returns a long.
The string indicates the unit. The datetimeField indicates the unit.
Only TIMEZONE_HOUR and TIMEZONE_MINUTE fields use the time zone offset component. Only TIMEZONE_HOUR and TIMEZONE_MINUTE fields use the time zone offset component.
With all other fields if date/time values have time zone offset component it is ignored. With all other fields if date/time values have time zone offset component it is ignored.
"," ","
......
...@@ -529,7 +529,7 @@ H2 internally uses Unicode, and supports all character encoding systems and char ...@@ -529,7 +529,7 @@ H2 internally uses Unicode, and supports all character encoding systems and char
<p> <p>
Using a native wrapper / adapter, Java applications can be run as a Windows Service. Using a native wrapper / adapter, Java applications can be run as a Windows Service.
There are various tools available to do that. The Java Service Wrapper from There are various tools available to do that. The Java Service Wrapper from
<a href="http://wrapper.tanukisoftware.org">Tanuki Software, Inc.</a> <a href="https://wrapper.tanukisoftware.org">Tanuki Software, Inc.</a>
is included in the installation. Batch files are provided to install, start, stop and uninstall the is included in the installation. Batch files are provided to install, start, stop and uninstall the
H2 Database Engine Service. This service contains the TCP Server and the H2 Console web application. H2 Database Engine Service. This service contains the TCP Server and the H2 Console web application.
The batch files are located in the directory <code>h2/service</code>. The batch files are located in the directory <code>h2/service</code>.
...@@ -538,7 +538,7 @@ The batch files are located in the directory <code>h2/service</code>. ...@@ -538,7 +538,7 @@ The batch files are located in the directory <code>h2/service</code>.
The service wrapper bundled with H2 is a 32-bit version. The service wrapper bundled with H2 is a 32-bit version.
To use a 64-bit version of Windows (x64), you need to use a 64-bit version of the wrapper, To use a 64-bit version of Windows (x64), you need to use a 64-bit version of the wrapper,
for example the one from for example the one from
<a href="http://www.krenger.ch/blog/java-service-wrapper-3-5-14-for-windows-x64/"> <a href="https://www.krenger.ch/blog/java-service-wrapper-3-5-14-for-windows-x64/">
Simon Krenger</a>. Simon Krenger</a>.
</p> </p>
<p> <p>
...@@ -604,7 +604,7 @@ To use the PostgreSQL ODBC driver on 64 bit versions of Windows, ...@@ -604,7 +604,7 @@ To use the PostgreSQL ODBC driver on 64 bit versions of Windows,
first run <code>c:/windows/syswow64/odbcad32.exe</code>. first run <code>c:/windows/syswow64/odbcad32.exe</code>.
At this point you set up your DSN just like you would on any other system. At this point you set up your DSN just like you would on any other system.
See also: See also:
<a href="http://archives.postgresql.org/pgsql-odbc/2005-09/msg00125.php">Re: ODBC Driver on Windows 64 bit</a> <a href="https://www.postgresql.org/message-id/dg76q0$khn$1@sea.gmane.org">Re: ODBC Driver on Windows 64 bit</a>
</p> </p>
<h3>ODBC Installation</h3> <h3>ODBC Installation</h3>
...@@ -612,7 +612,7 @@ See also: ...@@ -612,7 +612,7 @@ See also:
First, the ODBC driver must be installed. First, the ODBC driver must be installed.
Any recent PostgreSQL ODBC driver should work, however version 8.2 (<code>psqlodbc-08_02*</code>) or newer is recommended. Any recent PostgreSQL ODBC driver should work, however version 8.2 (<code>psqlodbc-08_02*</code>) or newer is recommended.
The Windows version of the PostgreSQL ODBC driver is available at The Windows version of the PostgreSQL ODBC driver is available at
<a href="http://www.postgresql.org/ftp/odbc/versions/msi">http://www.postgresql.org/ftp/odbc/versions/msi</a>. <a href="https://www.postgresql.org/ftp/odbc/versions/msi/">https://www.postgresql.org/ftp/odbc/versions/msi/</a>.
</p> </p>
<h3>Starting the Server</h3> <h3>Starting the Server</h3>
...@@ -727,11 +727,11 @@ You can access a H2 database on .NET using the JDBC API, or using the ADO.NET in ...@@ -727,11 +727,11 @@ You can access a H2 database on .NET using the JDBC API, or using the ADO.NET in
<h3>Using the ADO.NET API on .NET</h3> <h3>Using the ADO.NET API on .NET</h3>
<p> <p>
An implementation of the ADO.NET interface is available in the open source project An implementation of the ADO.NET interface is available in the open source project
<a href="http://code.google.com/p/h2sharp">H2Sharp</a>. <a href="https://code.google.com/archive/p/h2sharp/">H2Sharp</a>.
</p> </p>
<h3>Using the JDBC API on .NET</h3> <h3>Using the JDBC API on .NET</h3>
<ul><li>Install the .NET Framework from <a href="http://www.microsoft.com">Microsoft</a>. <ul><li>Install the .NET Framework from <a href="https://www.microsoft.com">Microsoft</a>.
Mono has not yet been tested. Mono has not yet been tested.
</li><li>Install <a href="http://www.ikvm.net">IKVM.NET</a>. </li><li>Install <a href="http://www.ikvm.net">IKVM.NET</a>.
</li><li>Copy the <code>h2*.jar</code> file to <code>ikvm/bin</code> </li><li>Copy the <code>h2*.jar</code> file to <code>ikvm/bin</code>
...@@ -855,9 +855,9 @@ Unfortunately, even when calling <code>FileDescriptor.sync()</code> or ...@@ -855,9 +855,9 @@ Unfortunately, even when calling <code>FileDescriptor.sync()</code> or
<code>FileChannel.force()</code>, <code>FileChannel.force()</code>,
data is not always persisted to the hard drive, because most hard drives do not obey data is not always persisted to the hard drive, because most hard drives do not obey
<code>fsync()</code>: see <code>fsync()</code>: see
<a href="http://hardware.slashdot.org/article.pl?sid=05/05/13/0529252">Your Hard Drive Lies to You</a>. <a href="https://hardware.slashdot.org/story/05/05/13/0529252/your-hard-drive-lies-to-you">Your Hard Drive Lies to You</a>.
In Mac OS X, <code>fsync</code> does not flush hard drive buffers. See In Mac OS X, <code>fsync</code> does not flush hard drive buffers. See
<a href="http://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html">Bad fsync?</a>. <a href="https://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html">Bad fsync?</a>.
So the situation is confusing, and tests prove there is a problem. So the situation is confusing, and tests prove there is a problem.
</p> </p>
<p> <p>
...@@ -1563,7 +1563,7 @@ The current value of the settings can be read in the table ...@@ -1563,7 +1563,7 @@ The current value of the settings can be read in the table
</p> </p>
<p> <p>
For a complete list of settings, see For a complete list of settings, see
<a href="../javadoc/org/h2/engine/SysProperties.html">SysProperties</a>. <a href="http://www.h2database.com/javadoc/org/h2/engine/SysProperties.html">SysProperties</a>.
</p> </p>
<h2 id="server_bind_address">Setting the Server Bind Address</h2> <h2 id="server_bind_address">Setting the Server Bind Address</h2>
...@@ -1675,7 +1675,8 @@ Java objects serialization is enabled by default for columns of type <code>OTHER ...@@ -1675,7 +1675,8 @@ Java objects serialization is enabled by default for columns of type <code>OTHER
To disable this feature set the system property <code>h2.serializeJavaObject=false</code> (default: true). To disable this feature set the system property <code>h2.serializeJavaObject=false</code> (default: true).
</p> </p>
<p> <p>
Serialization and deserialization of java objects is customizable both at system level and at database level providing a <a href="../javadoc/org/h2/api/JavaObjectSerializer.html">JavaObjectSerializer</a> implementation: Serialization and deserialization of java objects is customizable both at system level and at database level providing a
<a href="http://www.h2database.com/javadoc/org/h2/api/JavaObjectSerializer.html">JavaObjectSerializer</a> implementation:
<ul> <ul>
<li> <li>
At system level set the system property <code>h2.javaObjectSerializer</code> with the At system level set the system property <code>h2.javaObjectSerializer</code> with the
...@@ -1699,7 +1700,8 @@ It is possible to extend the type system of the database by providing your own i ...@@ -1699,7 +1700,8 @@ It is possible to extend the type system of the database by providing your own i
of minimal required API basically consisting of type identification and conversion routines. of minimal required API basically consisting of type identification and conversion routines.
</p> </p>
<p> <p>
In order to enable this feature, set the system property <code>h2.customDataTypesHandler</code> (default: null) to the fully qualified name of the class providing <a href="../javadoc/org/h2/api/CustomDataTypesHandler.html">CustomDataTypesHandler</a> interface implementation. <br /> In order to enable this feature, set the system property <code>h2.customDataTypesHandler</code> (default: null) to the fully qualified name of the class providing
<a href="http://www.h2database.com/javadoc/org/h2/api/CustomDataTypesHandler.html">CustomDataTypesHandler</a> interface implementation. <br />
The instance of that class will be created by H2 and used to: The instance of that class will be created by H2 and used to:
<ul> <ul>
<li>resolve the names and identifiers of extrinsic data types. <li>resolve the names and identifiers of extrinsic data types.
...@@ -1764,53 +1766,53 @@ OR X = 2 OR X = 2 OR X = 2 OR X = 2 OR X = 2 ...@@ -1764,53 +1766,53 @@ OR X = 2 OR X = 2 OR X = 2 OR X = 2 OR X = 2
<tr> <tr>
<td>AES-128</td> <td>AES-128</td>
<td>A block encryption algorithm. See also: <a <td>A block encryption algorithm. See also: <a
href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Wikipedia: href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Wikipedia:
AES</a></td> Advanced Encryption Standard</a></td>
</tr> </tr>
<tr> <tr>
<td>Birthday Paradox</td> <td>Birthday Paradox</td>
<td>Describes the higher than expected probability that two <td>Describes the higher than expected probability that two
persons in a room have the same birthday. Also valid for randomly persons in a room have the same birthday. Also valid for randomly
generated UUIDs. See also: <a generated UUIDs. See also: <a
href="http://en.wikipedia.org/wiki/Birthday_paradox">Wikipedia: href="https://en.wikipedia.org/wiki/Birthday_problem">Wikipedia:
Birthday Paradox</a></td> Birthday problem</a></td>
</tr> </tr>
<tr> <tr>
<td>Digest</td> <td>Digest</td>
<td>Protocol to protect a password (but not to protect data). <td>Protocol to protect a password (but not to protect data).
See also: <a href="http://www.faqs.org/rfcs/rfc2617.html">RFC See also: <a href="https://www.ietf.org/rfc/rfc2617.txt">RFC
2617: HTTP Digest Access Authentication</a></td> 2617: HTTP Digest Access Authentication</a></td>
</tr> </tr>
<tr> <tr>
<td>HTTPS</td> <td>HTTPS</td>
<td>A protocol to provide security to HTTP connections. See <td>A protocol to provide security to HTTP connections. See
also: <a href="http://www.ietf.org/rfc/rfc2818.txt">RFC 2818: also: <a href="https://www.ietf.org/rfc/rfc2818.txt">RFC 2818:
HTTP Over TLS</a></td> HTTP Over TLS</a></td>
</tr> </tr>
<tr> <tr>
<td>Modes of Operation</td> <td>Modes of Operation</td>
<td><a <td><a
href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation">Wikipedia: href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation">Wikipedia:
Block cipher modes of operation</a></td> Block cipher mode of operation</a></td>
</tr> </tr>
<tr> <tr>
<td>Salt</td> <td>Salt</td>
<td>Random number to increase the security of passwords. See <td>Random number to increase the security of passwords. See
also: <a href="http://en.wikipedia.org/wiki/Key_derivation_function">Wikipedia: also: <a href="https://en.wikipedia.org/wiki/Key_derivation_function">Wikipedia:
Key derivation function</a></td> Key derivation function</a></td>
</tr> </tr>
<tr> <tr>
<td>SHA-256</td> <td>SHA-256</td>
<td>A cryptographic one-way hash function. See also: <a <td>A cryptographic one-way hash function. See also: <a
href="http://en.wikipedia.org/wiki/SHA_family">Wikipedia: SHA href="https://en.wikipedia.org/wiki/Secure_Hash_Algorithms">Wikipedia:
hash functions</a></td> Secure Hash Algorithms</a></td>
</tr> </tr>
<tr> <tr>
<td>SQL Injection</td> <td>SQL Injection</td>
<td>A security vulnerability where an application embeds SQL <td>A security vulnerability where an application embeds SQL
statements or expressions in user input. See also: <a statements or expressions in user input. See also: <a
href="http://en.wikipedia.org/wiki/SQL_injection">Wikipedia: href="https://en.wikipedia.org/wiki/SQL_injection">Wikipedia:
SQL Injection</a></td> SQL injection</a></td>
</tr> </tr>
<tr> <tr>
<td>Watermark Attack</td> <td>Watermark Attack</td>
......
...@@ -86,7 +86,7 @@ The primary classes of interest are: ...@@ -86,7 +86,7 @@ The primary classes of interest are:
The parser lives in <code>org.h2.command.Parser</code>. It uses a straightforward recursive-descent design. The parser lives in <code>org.h2.command.Parser</code>. It uses a straightforward recursive-descent design.
</p> </p>
<p> <p>
See Wikipedia <a href="http://en.wikipedia.org/wiki/Recursive_descent_parser">Recursive-descent parser</a> page. See Wikipedia <a href="https://en.wikipedia.org/wiki/Recursive_descent_parser">Recursive descent parser</a> page.
</p> </p>
...@@ -120,8 +120,8 @@ The primary packages of interest are: ...@@ -120,8 +120,8 @@ The primary packages of interest are:
<h2 id="transaction">Undo log, redo log, and transactions layer</h2> <h2 id="transaction">Undo log, redo log, and transactions layer</h2>
<p> <p>
We have a transaction log, which is shared among all sessions. See also We have a transaction log, which is shared among all sessions. See also
http://en.wikipedia.org/wiki/Transaction_log <a href="https://en.wikipedia.org/wiki/Transaction_log">https://en.wikipedia.org/wiki/Transaction_log</a>
http://h2database.com/html/grammar.html#set_log <a href="http://h2database.com/html/grammar.html#set_log">http://h2database.com/html/grammar.html#set_log</a>
</p> </p>
<p> <p>
We also have an undo log, which is per session, to undo an operation (an update that fails for example) We also have an undo log, which is per session, to undo an operation (an update that fails for example)
......
...@@ -49,20 +49,21 @@ This database is written in Java and therefore works on many platforms. ...@@ -49,20 +49,21 @@ This database is written in Java and therefore works on many platforms.
<h2 id="environment">Environment</h2> <h2 id="environment">Environment</h2>
<p> <p>
To run this database, a Java Runtime Environment (JRE) version 1.7 or higher is required. To run this database, a Java Runtime Environment (JRE) version 7 or higher is required.
</p> </p>
<p> <p>
To create the database executables, the following software stack was used. To create the database executables, the following software stack was used.
To use this database, it is not required to install this software however. To use this database, it is not required to install this software however.
</p> </p>
<ul><li>Mac OS X and Windows <ul><li>Mac OS X and Windows
</li><li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Oracle JDK Version 1.7</a> </li><li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Oracle JDK Version 7</a>
(version 7 is not available for free download any more)
</li><li><a href="http://www.eclipse.org">Eclipse</a> </li><li><a href="http://www.eclipse.org">Eclipse</a>
</li><li>Eclipse Plugins: </li><li>Eclipse Plugins:
<a href="http://subclipse.tigris.org">Subclipse</a>, <a href="http://subclipse.tigris.org">Subclipse</a>,
<a href="http://eclipse-cs.sourceforge.net">Eclipse Checkstyle Plug-in</a>, <a href="https://checkstyle.github.io/eclipse-cs/">Eclipse Checkstyle Plug-in</a>,
<a href="http://www.eclemma.org">EclEmma Java Code Coverage</a> <a href="http://www.eclemma.org">EclEmma Java Code Coverage</a>
</li><li><a href="http://www.mozilla.com/firefox">Mozilla Firefox</a> </li><li><a href="https://www.mozilla.com/firefox">Mozilla Firefox</a>
</li><li><a href="http://www.openoffice.org">OpenOffice</a> </li><li><a href="http://www.openoffice.org">OpenOffice</a>
</li><li><a href="http://nsis.sourceforge.net">NSIS</a> (Nullsoft Scriptable Install System) </li><li><a href="http://nsis.sourceforge.net">NSIS</a> (Nullsoft Scriptable Install System)
</li><li><a href="http://maven.apache.org">Maven</a> </li><li><a href="http://maven.apache.org">Maven</a>
...@@ -70,7 +71,7 @@ To use this database, it is not required to install this software however. ...@@ -70,7 +71,7 @@ To use this database, it is not required to install this software however.
<h2 id="building">Building the Software</h2> <h2 id="building">Building the Software</h2>
<p> <p>
You need to install a JDK, for example the Oracle JDK version 1.7 or 1.8. You need to install a JDK, for example the Oracle JDK version 7 or 8.
Ensure that Java binary directory is included in the <code>PATH</code> environment variable, and that Ensure that Java binary directory is included in the <code>PATH</code> environment variable, and that
the environment variable <code>JAVA_HOME</code> points to your Java installation. the environment variable <code>JAVA_HOME</code> points to your Java installation.
On the command line, go to the directory <code>h2</code> and execute the following command: On the command line, go to the directory <code>h2</code> and execute the following command:
...@@ -88,12 +89,15 @@ You will get a list of targets. If you want to build the <code>jar</code> file, ...@@ -88,12 +89,15 @@ You will get a list of targets. If you want to build the <code>jar</code> file,
build jar build jar
</pre> </pre>
<p> <p>
To run the build tool in shell mode, use the command line option <code>-</code> as in <code>./build.sh -</code>. To run the build tool in shell mode, use the command line option <code>-</code>:
</p> </p>
<pre>
./build.sh -
</pre>
<h3>Switching the Source Code</h3> <h3>Switching the Source Code</h3>
<p> <p>
The source code uses Java 1.7 features. The source code uses Java 7 features.
To switch the source code to the installed version of Java, run: To switch the source code to the installed version of Java, run:
</p> </p>
<pre> <pre>
...@@ -148,7 +152,7 @@ however after a new release it may take a few hours before they are available th ...@@ -148,7 +152,7 @@ however after a new release it may take a few hours before they are available th
<h3>Maven Plugin to Start and Stop the TCP Server</h3> <h3>Maven Plugin to Start and Stop the TCP Server</h3>
<p> <p>
A Maven plugin to start and stop the H2 TCP server is available from A Maven plugin to start and stop the H2 TCP server is available from
<a href="http://github.com/ljnelson/h2-maven-plugin">Laird Nelson at GitHub</a>. <a href="https://github.com/ljnelson/h2-maven-plugin">Laird Nelson at GitHub</a>.
To start the H2 server, use: To start the H2 server, use:
</p> </p>
<pre> <pre>
...@@ -246,7 +250,7 @@ If you'd like to contribute bug fixes or new features, please consider the follo ...@@ -246,7 +250,7 @@ If you'd like to contribute bug fixes or new features, please consider the follo
<p> <p>
For legal reasons, patches need to be public in the form of an For legal reasons, patches need to be public in the form of an
<a href="https://github.com/h2database/h2database/issues">issue report or attachment</a> or in the form of an email <a href="https://github.com/h2database/h2database/issues">issue report or attachment</a> or in the form of an email
to the <a href="http://groups.google.com/group/h2-database">group</a>. to the <a href="https://groups.google.com/group/h2-database">group</a>.
Significant contributions need to include the following statement: Significant contributions need to include the following statement:
</p> </p>
<p> <p>
...@@ -272,8 +276,7 @@ or if you have a feature request: ...@@ -272,8 +276,7 @@ or if you have a feature request:
please report the problem, including the complete error message and stack trace, please report the problem, including the complete error message and stack trace,
and the root cause stack trace(s). and the root cause stack trace(s).
</li><li>When sending source code, please use a public web clipboard such as </li><li>When sending source code, please use a public web clipboard such as
<a href="http://pastebin.com">Pastebin</a>, <a href="https://pastebin.com/">Pastebin</a> or
<a href="http://cl1p.net">Cl1p</a>, or
<a href="http://www.mysticpaste.com/new">Mystic Paste</a> <a href="http://www.mysticpaste.com/new">Mystic Paste</a>
to avoid formatting problems. to avoid formatting problems.
Please keep test cases as simple and short as possible, Please keep test cases as simple and short as possible,
...@@ -285,8 +288,8 @@ or if you have a feature request: ...@@ -285,8 +288,8 @@ or if you have a feature request:
Please use the JDBC API and no external tools or libraries. Please use the JDBC API and no external tools or libraries.
The test should include all required initialization code, and The test should include all required initialization code, and
should be started with the main method. should be started with the main method.
</li><li>For large attachments, use a public temporary storage such as </li><li>For large attachments, use a public storage such as
<a href="http://rapidshare.com">Rapidshare</a>. <a href="https://www.google.com/drive/">Google Drive</a>.
</li><li>Google Group versus issue tracking: </li><li>Google Group versus issue tracking:
Use the Use the
<a href="http://groups.google.com/group/h2-database">Google Group</a> <a href="http://groups.google.com/group/h2-database">Google Group</a>
......
...@@ -68,8 +68,6 @@ Here is the list of known and confirmed issues: ...@@ -68,8 +68,6 @@ Here is the list of known and confirmed issues:
USA, or within Europe), even if the timezone itself is different. As a workaround, export the USA, or within Europe), even if the timezone itself is different. As a workaround, export the
database to a SQL script using the old timezone, and create a new database in the new database to a SQL script using the old timezone, and create a new database in the new
timezone. timezone.
</li><li>Apache Harmony: there seems to be a bug in Harmony that affects H2.
See <a href="http://issues.apache.org/jira/browse/HARMONY-6505">HARMONY-6505</a>.
</li><li>Tomcat and Glassfish 3 set most static fields (final or non-final) to <code>null</code> when </li><li>Tomcat and Glassfish 3 set most static fields (final or non-final) to <code>null</code> when
unloading a web application. This can cause a <code>NullPointerException</code> in H2 versions unloading a web application. This can cause a <code>NullPointerException</code> in H2 versions
1.1.107 and older, and may still not work in newer versions. Please report it if you 1.1.107 and older, and may still not work in newer versions. Please report it if you
...@@ -81,11 +79,6 @@ Here is the list of known and confirmed issues: ...@@ -81,11 +79,6 @@ Here is the list of known and confirmed issues:
</li><li>Some problems have been found with right outer join. Internally, it is converted </li><li>Some problems have been found with right outer join. Internally, it is converted
to left outer join, which does not always produce the same results as other databases to left outer join, which does not always produce the same results as other databases
when used in combination with other joins. This problem is fixed in H2 version 1.3. when used in combination with other joins. This problem is fixed in H2 version 1.3.
</li><li>When using Install4j before 4.1.4 on Linux and enabling <code>pack200</code>,
the <code>h2*.jar</code> becomes corrupted by the install process, causing application failure.
A workaround is to add an empty file <code>h2*.jar.nopack</code>
next to the <code>h2*.jar</code> file.
This problem is solved in Install4j 4.1.4.
</li></ul> </li></ul>
<p> <p>
For a complete list, see <a href="https://github.com/h2database/h2database/issues">Open Issues</a>. For a complete list, see <a href="https://github.com/h2database/h2database/issues">Open Issues</a>.
...@@ -172,7 +165,7 @@ When using one of the following features for production, please ensure your use ...@@ -172,7 +165,7 @@ When using one of the following features for production, please ensure your use
is well tested (if possible with automated test cases). The areas that are not well tested are: is well tested (if possible with automated test cases). The areas that are not well tested are:
</p> </p>
<ul> <ul>
<li>Platforms other than Windows, Linux, Mac OS X, or JVMs other than Oracle 1.6, 1.7, 1.8. <li>Platforms other than Windows, Linux, Mac OS X, or runtime environments other than Oracle / OpenJDK 7, 8, 9.
</li><li>The features <code>AUTO_SERVER</code> and <code>AUTO_RECONNECT</code>. </li><li>The features <code>AUTO_SERVER</code> and <code>AUTO_RECONNECT</code>.
</li><li>Cluster mode, 2-phase commit, savepoints. </li><li>Cluster mode, 2-phase commit, savepoints.
</li><li>Fulltext search. </li><li>Fulltext search.
......
...@@ -163,8 +163,8 @@ This comparison is based on ...@@ -163,8 +163,8 @@ This comparison is based on
H2 1.3, H2 1.3,
<a href="http://db.apache.org/derby">Apache Derby version 10.8</a>, <a href="http://db.apache.org/derby">Apache Derby version 10.8</a>,
<a href="http://hsqldb.org">HSQLDB 2.2</a>, <a href="http://hsqldb.org">HSQLDB 2.2</a>,
<a href="http://mysql.com">MySQL 5.5</a>, <a href="https://www.mysql.com/">MySQL 5.5</a>,
<a href="http://www.postgresql.org">PostgreSQL 9.0</a>. <a href="https://www.postgresql.org/">PostgreSQL 9.0</a>.
</p> </p>
<table class="main"> <table class="main">
<tr> <tr>
...@@ -370,7 +370,7 @@ H2 1.3, ...@@ -370,7 +370,7 @@ H2 1.3,
*8 Derby doesn't support standard compliant information schema tables.<br /> *8 Derby doesn't support standard compliant information schema tables.<br />
*9 When using MVCC (multi version concurrency).<br /> *9 When using MVCC (multi version concurrency).<br />
*10 Derby and HSQLDB *10 Derby and HSQLDB
<a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29">don't hide data patterns well</a>.<br /> <a href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_Codebook_(ECB)">don't hide data patterns well</a>.<br />
*11 The MULTI_THREADED option is not enabled by default, and with version 1.3.x not supported when using MVCC.<br /> *11 The MULTI_THREADED option is not enabled by default, and with version 1.3.x not supported when using MVCC.<br />
*12 Derby doesn't support the <code>EXPLAIN</code> statement, but it supports runtime statistics and retrieving statement execution plans.<br /> *12 Derby doesn't support the <code>EXPLAIN</code> statement, but it supports runtime statistics and retrieving statement execution plans.<br />
*13 Derby doesn't support the syntax <code>LIMIT .. [OFFSET ..]</code>, however it supports <code>FETCH FIRST .. ROW[S] ONLY</code>.<br /> *13 Derby doesn't support the syntax <code>LIMIT .. [OFFSET ..]</code>, however it supports <code>FETCH FIRST .. ROW[S] ONLY</code>.<br />
...@@ -378,16 +378,6 @@ H2 1.3, ...@@ -378,16 +378,6 @@ H2 1.3,
*15 Derby and H2 support <code>ROW_NUMBER() OVER()</code>. *15 Derby and H2 support <code>ROW_NUMBER() OVER()</code>.
</p> </p>
<h3>DaffodilDb and One$Db</h3>
<p>
It looks like the development of this database has stopped. The last release was February 2006.
</p>
<h3>McKoi</h3>
<p>
It looks like the development of this database has stopped. The last release was August 2004.
</p>
<h2 id="products_work_with">H2 in Use</h2> <h2 id="products_work_with">H2 in Use</h2>
<p> <p>
For a list of applications that work with or use H2, see: For a list of applications that work with or use H2, see:
...@@ -819,7 +809,7 @@ other database settings can be passed in the database URL. ...@@ -819,7 +809,7 @@ other database settings can be passed in the database URL.
Adding <code>;setting=value</code> at the end of a database URL is the Adding <code>;setting=value</code> at the end of a database URL is the
same as executing the statement <code>SET setting value</code> just after same as executing the statement <code>SET setting value</code> just after
connecting. For a list of supported settings, see <a href="grammar.html">SQL Grammar</a> connecting. For a list of supported settings, see <a href="grammar.html">SQL Grammar</a>
or the <a href="../javadoc/org/h2/engine/DbSettings.html">DbSettings</a> javadoc. or the <a href="http://www.h2database.com/javadoc/org/h2/engine/DbSettings.html">DbSettings</a> javadoc.
</p> </p>
<h2 id="custom_access_mode">Custom File Access Mode</h2> <h2 id="custom_access_mode">Custom File Access Mode</h2>
...@@ -1326,7 +1316,7 @@ In most cases, this is sufficient, however sometimes it is better to use the sam ...@@ -1326,7 +1316,7 @@ In most cases, this is sufficient, however sometimes it is better to use the sam
facility as the application, for example Log4j. To do that, this database support SLF4J. facility as the application, for example Log4j. To do that, this database support SLF4J.
</p> </p>
<p> <p>
<a href="http://www.slf4j.org">SLF4J</a> is a simple facade for various logging APIs <a href="https://www.slf4j.org/">SLF4J</a> is a simple facade for various logging APIs
and allows to plug in the desired implementation at deployment time. and allows to plug in the desired implementation at deployment time.
SLF4J supports implementations such as Logback, Log4j, Jakarta Commons Logging (JCL), SLF4J supports implementations such as Logback, Log4j, Jakarta Commons Logging (JCL),
Java logging, x4juli, and Simple Log. Java logging, x4juli, and Simple Log.
......
...@@ -78,15 +78,16 @@ translate --> ...@@ -78,15 +78,16 @@ translate -->
<a href="grammar.html">SQL Grammar</a><br /> <a href="grammar.html">SQL Grammar</a><br />
<a href="functions.html">Functions</a><br /> <a href="functions.html">Functions</a><br />
<a href="datatypes.html">Data Types</a><br /> <a href="datatypes.html">Data Types</a><br />
<a href="systemtables.html">System Tables</a><br />
<a href="../javadoc/index.html">Javadoc</a><br /> <a href="../javadoc/index.html">Javadoc</a><br />
<a href="../h2.pdf">PDF (1 MB)</a><br /> <a href="../h2.pdf">PDF (1 MB)</a><br />
<br /> <br />
<b>Support</b><br /> <b>Support</b><br />
<a href="faq.html">FAQ</a><br /> <a href="faq.html">FAQ</a><br />
<a href="sourceError.html">Error Analyzer</a><br /> <a href="sourceError.html">Error Analyzer</a><br />
<a href="http://groups.google.com/group/h2-database">Google Group (English)</a><br /> <a href="https://groups.google.com/group/h2-database">Google Group (English)</a><br />
<a href="http://groups.google.co.jp/group/h2-database-jp">Google Group (Japanese)</a><br /> <a href="https://groups.google.co.jp/group/h2-database-jp">Google Group (Japanese)</a><br />
<a href="http://groups.google.com/group/h2-cn">Google Group (Chinese)</a><br /> <a href="https://groups.google.com/group/h2-cn">Google Group (Chinese)</a><br />
<br /> <br />
<b>Appendix</b><br /> <b>Appendix</b><br />
<a href="history.html">History &amp; Roadmap</a><br /> <a href="history.html">History &amp; Roadmap</a><br />
......
...@@ -159,12 +159,6 @@ syntax-end --> ...@@ -159,12 +159,6 @@ syntax-end -->
</table> </table>
<!-- railroad-end --> <!-- railroad-end -->
<h3>System Tables</h3>
<p class="notranslate">
<a href="#information_schema">Information Schema</a><br />
<a href="#range_table">Range Table</a><br />
</p>
<!-- railroad-start --> <!-- railroad-start -->
<h2>Details</h2> <h2>Details</h2>
<p>Click on the header to switch between railroad diagram and BNF.</p> <p>Click on the header to switch between railroad diagram and BNF.</p>
...@@ -274,34 +268,6 @@ syntax-end --> ...@@ -274,34 +268,6 @@ syntax-end -->
<p class="notranslate">${item.example}</p> <p class="notranslate">${item.example}</p>
</c:forEach> </c:forEach>
<h2>System Tables</h2>
<h3 id="information_schema" class="notranslate">Information Schema</h3>
<p>
The system tables in the schema <code>INFORMATION_SCHEMA</code> contain the meta data
of all tables in the database as well as the current settings.
</p>
<table class="main">
<tr><th>Table</th><th>Columns</th></tr>
<c:forEach var="item" items="informationSchema">
<tr class="notranslate">
<td>${item.topic}</td>
<td>${item.syntax}</td>
</tr>
</c:forEach>
</table>
<h3 id="range_table" class="notranslate">Range Table</h3>
<p>
The range table is a dynamic system table that contains all values from a start to an end value.
The table contains one column called X. Both the start and end values are included in the result.
The table is used as follows:
</p>
<p>Example:</p>
<pre>
SELECT X FROM SYSTEM_RANGE(1, 10);
</pre>
<!--[if lte IE 7]><script language="javascript">switchBnf(null);</script><![endif]--> <!--[if lte IE 7]><script language="javascript">switchBnf(null);</script><![endif]-->
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html> <!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
...@@ -154,7 +154,7 @@ Welcome to H2, the Java SQL database. The main features of H2 are: ...@@ -154,7 +154,7 @@ Welcome to H2, the Java SQL database. The main features of H2 are:
or <a href="http://www.h2database.com/html/newsfeed-rss.xml">Header only (RSS)</a>. or <a href="http://www.h2database.com/html/newsfeed-rss.xml">Header only (RSS)</a>.
</p><p> </p><p>
<b>Email Newsletter:</b> Subscribe to <b>Email Newsletter:</b> Subscribe to
<a href="http://groups.google.com/group/h2database-news/subscribe"> <a href="https://groups.google.com/group/h2database-news/subscribe">
H2 Database News (Google account required)</a> H2 Database News (Google account required)</a>
to get informed about new releases. to get informed about new releases.
Your email address is only used in this context. Your email address is only used in this context.
......
...@@ -71,9 +71,8 @@ table { ...@@ -71,9 +71,8 @@ table {
th { th {
font-size: 14pt; font-size: 14pt;
font-weight: normal; font-weight: bold;
text-align: left; text-align: left;
background-color: #ece9d8;
border: 1px solid #aca899; border: 1px solid #aca899;
padding: 2px; padding: 2px;
} }
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0, Version 1.0,
and under the Eclipse Public License, Version 1.0
Initial Developer: H2 Group
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
System Tables
</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<!-- [search] { -->
<script type="text/javascript" src="navigation.js"></script>
</head><body onload="frameMe();">
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<!-- } -->
<h1>System Tables</h1>
<p class="notranslate">
<a href="#information_schema">Information Schema</a><br />
<a href="#range_table">Range Table</a><br />
</p>
<h2 id="information_schema" class="notranslate">Information Schema</h2>
<p>
The system tables in the schema <code>INFORMATION_SCHEMA</code> contain the meta data
of all tables in the database as well as the current settings.
</p>
<c:forEach var="item" items="informationSchema">
<h3 class="notranslate">${item.topic}</h3>
<p class="notranslate">${item.syntax}</p>
</c:forEach>
<h2 id="range_table" class="notranslate">Range Table</h2>
<p>
The range table is a dynamic system table that contains all values from a start to an end value.
The table contains one column called X. Both the start and end values are included in the result.
The table is used as follows:
</p>
<p>Example:</p>
<pre>
SELECT X FROM SYSTEM_RANGE(1, 10);
</pre>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
...@@ -564,11 +564,7 @@ Shutting down a TCP server can be protected using the option <code>-tcpPassword< ...@@ -564,11 +564,7 @@ Shutting down a TCP server can be protected using the option <code>-tcpPassword<
<h2 id="using_hibernate">Using Hibernate</h2> <h2 id="using_hibernate">Using Hibernate</h2>
<p> <p>
This database supports Hibernate version 3.1 and newer. You can use the HSQLDB Dialect, This database supports Hibernate version 3.1 and newer. You can use the HSQLDB Dialect,
or the native H2 Dialect. Unfortunately the H2 Dialect included in some old versions of Hibernate was buggy. or the native H2 Dialect.
A <a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-3401">patch
for Hibernate</a> has been submitted and is now applied.
You can rename it to <code>H2Dialect.java</code> and include this as a patch in your application,
or upgrade to a version of Hibernate where this is fixed.
</p> </p>
<p> <p>
When using Hibernate, try to use the <code>H2Dialect</code> if possible. When using Hibernate, try to use the <code>H2Dialect</code> if possible.
...@@ -630,10 +626,6 @@ Another (more dangerous) solution is to set <code>useDatabaseLock</code> to fals ...@@ -630,10 +626,6 @@ Another (more dangerous) solution is to set <code>useDatabaseLock</code> to fals
<h2 id="using_netbeans">Using H2 within NetBeans</h2> <h2 id="using_netbeans">Using H2 within NetBeans</h2>
<p> <p>
The project <a href="http://kenai.com/projects/nbh2">H2 Database Engine Support For NetBeans</a>
allows you to start and stop the H2 server from within the IDE.
</p>
<p>
There is a known issue when using the Netbeans SQL Execution Window: There is a known issue when using the Netbeans SQL Execution Window:
before executing a query, another query in the form <code>SELECT COUNT(*) FROM &lt;query&gt;</code> is run. before executing a query, another query in the form <code>SELECT COUNT(*) FROM &lt;query&gt;</code> is run.
This is a problem for queries that modify state, such as <code>SELECT SEQ.NEXTVAL</code>. This is a problem for queries that modify state, such as <code>SELECT SEQ.NEXTVAL</code>.
...@@ -1154,9 +1146,9 @@ Example permission tags: ...@@ -1154,9 +1146,9 @@ Example permission tags:
For H2, opening a connection is fast if the database is already open. For H2, opening a connection is fast if the database is already open.
Still, using a connection pool improves performance if you open and close connections a lot. Still, using a connection pool improves performance if you open and close connections a lot.
A simple connection pool is included in H2. It is based on the A simple connection pool is included in H2. It is based on the
<a href="http://www.source-code.biz/snippets/java/8.htm">Mini Connection Pool Manager</a> <a href="http://www.source-code.biz/miniconnectionpoolmanager/">Mini Connection Pool Manager</a>
from Christian d'Heureuse. There are other, more complex, open source connection pools available, from Christian d'Heureuse. There are other, more complex, open source connection pools available,
for example the <a href="http://jakarta.apache.org/commons/dbcp/">Apache Commons DBCP</a>. for example the <a href="http://commons.apache.org/proper/commons-dbcp/">Apache Commons DBCP</a>.
For H2, it is about twice as faster to get a connection from the built-in connection pool than to get For H2, it is about twice as faster to get a connection from the built-in connection pool than to get
one using <code>DriverManager.getConnection()</code>.The build-in connection pool is used as follows: one using <code>DriverManager.getConnection()</code>.The build-in connection pool is used as follows:
</p> </p>
...@@ -1387,46 +1379,6 @@ Use the following configuration to start and stop the H2 TCP server using the Sp ...@@ -1387,46 +1379,6 @@ Use the following configuration to start and stop the H2 TCP server using the Sp
The <code>destroy-method</code> will help prevent exceptions on hot-redeployment or when restarting the server. The <code>destroy-method</code> will help prevent exceptions on hot-redeployment or when restarting the server.
</p> </p>
<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
a duplicate key condition, and so a <code>DataIntegrityViolationException</code> is thrown instead of
<code>DuplicateKeyException</code>.
See also <a href="http://jira.spring.io/browse/SPR-8235">the issue SPR-8235</a>.
The workaround is to add the following XML file to the root of the classpath:
</p>
<pre>
&lt;beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
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;property name="badSqlGrammarCodes"&gt;
&lt;value&gt;
42000,42001,42101,42102,42111,42112,42121,42122,42132
&lt;/value&gt;
&lt;/property&gt;
&lt;property name="duplicateKeyCodes"&gt;
&lt;value&gt;23001,23505&lt;/value&gt;
&lt;/property&gt;
&lt;property name="dataIntegrityViolationCodes"&gt;
&lt;value&gt;22003,22012,22025,23000&lt;/value&gt;
&lt;/property&gt;
&lt;property name="dataAccessResourceFailureCodes"&gt;
&lt;value&gt;90046,90100,90117,90121,90126&lt;/value&gt;
&lt;/property&gt;
&lt;property name="cannotAcquireLockCodes"&gt;
&lt;value&gt;50200&lt;/value&gt;
&lt;/property&gt;
&lt;/bean&gt;
&lt;/beans&gt;
</pre>
<h2 id="osgi">OSGi</h2> <h2 id="osgi">OSGi</h2>
<p> <p>
The standard H2 jar can be dropped in as a bundle in an OSGi container. The standard H2 jar can be dropped in as a bundle in an OSGi container.
......
...@@ -92,11 +92,15 @@ sub H2Pdf ...@@ -92,11 +92,15 @@ sub H2Pdf
dim linkStart(0) As New com.sun.star.beans.PropertyValue dim linkStart(0) As New com.sun.star.beans.PropertyValue
dim linkEnd(0) As New com.sun.star.beans.PropertyValue dim linkEnd(0) As New com.sun.star.beans.PropertyValue
For i = 1 To 4 for i = 1 To 4
oLevel = toc.LevelFormat.getByIndex(i) oLevel = toc.LevelFormat.getByIndex(i)
x = DimArray(5) bound = UBound(oLevel)
x = Array(linkStart, oLevel(0), oLevel(1), oLevel(2), oLevel(3), linkEnd) x = DimArray(bound + 2)
old = oLevel(0) x(0) = linkStart
for j = 0 to bound
x(j + 1) = oLevel(j)
next
x(bound + 2) = linkEnd
linkStart(0).Name = "TokenType" linkStart(0).Name = "TokenType"
linkStart(0).Value = "TokenHyperlinkStart" linkStart(0).Value = "TokenHyperlinkStart"
linkStart(0).Handle = -1 linkStart(0).Handle = -1
......
...@@ -1625,6 +1625,10 @@ public class Parser { ...@@ -1625,6 +1625,10 @@ public class Parser {
command.setIndexName(indexName); command.setIndexName(indexName);
ifExists = readIfExists(ifExists); ifExists = readIfExists(ifExists);
command.setIfExists(ifExists); command.setIfExists(ifExists);
//Support for MySQL: DROP INDEX index_name ON tbl_name
if (readIf("ON")) {
readIdentifierWithSchema();
}
return command; return command;
} else if (readIf("USER")) { } else if (readIf("USER")) {
boolean ifExists = readIfExists(false); boolean ifExists = readIfExists(false);
...@@ -6099,28 +6103,28 @@ public class Parser { ...@@ -6099,28 +6103,28 @@ public class Parser {
} else { } else {
readIf("COLUMN"); readIf("COLUMN");
boolean ifExists = readIfExists(false); boolean ifExists = readIfExists(false);
AlterTableAlterColumn command = new AlterTableAlterColumn(
session, schema);
command.setType(CommandInterface.ALTER_TABLE_DROP_COLUMN);
ArrayList<Column> columnsToRemove = New.arrayList(); ArrayList<Column> columnsToRemove = New.arrayList();
Table table = tableIfTableExists(schema, tableName, ifTableExists); Table table = tableIfTableExists(schema, tableName, ifTableExists);
// For Oracle compatibility - open bracket required // For Oracle compatibility - open bracket required
boolean openingBracketDetected = readIf("("); boolean openingBracketDetected = readIf("(");
do { do {
String columnName = readColumnIdentifier(); String columnName = readColumnIdentifier();
if (table == null) { if (table != null) {
return new NoOperation(session); if (!ifExists || table.doesColumnExist(columnName)) {
} Column column = table.getColumn(columnName);
if (ifExists && !table.doesColumnExist(columnName)) { columnsToRemove.add(column);
return new NoOperation(session); }
} }
Column column = table.getColumn(columnName);
columnsToRemove.add(column);
} while (readIf(",")); } while (readIf(","));
if (openingBracketDetected) { if (openingBracketDetected) {
// For Oracle compatibility - close bracket // For Oracle compatibility - close bracket
read(")"); read(")");
} }
if (table == null || columnsToRemove.isEmpty()) {
return new NoOperation(session);
}
AlterTableAlterColumn command = new AlterTableAlterColumn(session, schema);
command.setType(CommandInterface.ALTER_TABLE_DROP_COLUMN);
command.setTableName(tableName); command.setTableName(tableName);
command.setIfTableExists(ifTableExists); command.setIfTableExists(ifTableExists);
command.setColumnsToRemove(columnsToRemove); command.setColumnsToRemove(columnsToRemove);
......
...@@ -398,6 +398,8 @@ public class TestCompatibility extends TestBase { ...@@ -398,6 +398,8 @@ public class TestCompatibility extends TestBase {
// check the MySQL index dropping syntax // check the MySQL index dropping syntax
stat.execute("ALTER TABLE TEST_COMMENT_ENGINE ADD CONSTRAINT CommentUnique UNIQUE (SOME_ITEM_ID)"); stat.execute("ALTER TABLE TEST_COMMENT_ENGINE ADD CONSTRAINT CommentUnique UNIQUE (SOME_ITEM_ID)");
stat.execute("ALTER TABLE TEST_COMMENT_ENGINE DROP INDEX CommentUnique"); stat.execute("ALTER TABLE TEST_COMMENT_ENGINE DROP INDEX CommentUnique");
stat.execute("CREATE INDEX IDX_ATTACHMENT_ID ON TEST_COMMENT_ENGINE (ATTACHMENT_ID)");
stat.execute("DROP INDEX IDX_ATTACHMENT_ID ON TEST_COMMENT_ENGINE");
conn.close(); conn.close();
conn = getConnection("compatibility"); conn = getConnection("compatibility");
......
...@@ -101,7 +101,7 @@ public class TestScript extends TestBase { ...@@ -101,7 +101,7 @@ public class TestScript extends TestBase {
"uuid", "varchar", "varchar-ignorecase" }) { "uuid", "varchar", "varchar-ignorecase" }) {
testScript("datatypes/" + s + ".sql"); testScript("datatypes/" + s + ".sql");
} }
for (String s : new String[] { "alterTableAdd", "createView", "dropSchema" }) { for (String s : new String[] { "alterTableAdd", "alterTableDropColumn", "createView", "dropSchema" }) {
testScript("ddl/" + s + ".sql"); testScript("ddl/" + s + ".sql");
} }
for (String s : new String[] { "insertIgnore", "mergeUsing", "script", "with" }) { for (String s : new String[] { "insertIgnore", "mergeUsing", "script", "with" }) {
......
-- Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0,
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
CREATE TABLE TEST(A VARCHAR, B VARCHAR, C VARCHAR AS LOWER(A));
> ok
ALTER TABLE TEST DROP COLUMN B;
> ok
DROP TABLE TEST;
> ok
ALTER TABLE IF EXISTS TEST DROP COLUMN A;
> ok
ALTER TABLE TEST DROP COLUMN A;
> exception
CREATE TABLE TEST(A INT, B INT, C INT, D INT, E INT, F INT, G INT, H INT, I INT, J INT);
> ok
ALTER TABLE TEST DROP COLUMN IF EXISTS J;
> ok
ALTER TABLE TEST DROP COLUMN J;
> exception
ALTER TABLE TEST DROP COLUMN B;
> ok
ALTER TABLE TEST DROP COLUMN IF EXISTS C;
> ok
SELECT * FROM TEST;
> A D E F G H I
> - - - - - - -
> rows: 0
ALTER TABLE TEST DROP COLUMN B, D;
> exception
ALTER TABLE TEST DROP COLUMN IF EXISTS B, D;
> ok
SELECT * FROM TEST;
> A E F G H I
> - - - - - -
> rows: 0
ALTER TABLE TEST DROP COLUMN E, F;
> ok
SELECT * FROM TEST;
> A G H I
> - - - -
> rows: 0
ALTER TABLE TEST DROP COLUMN (B, H);
> exception
ALTER TABLE TEST DROP COLUMN IF EXISTS (B, H);
> ok
SELECT * FROM TEST;
> A G I
> - - -
> rows: 0
ALTER TABLE TEST DROP COLUMN (G, I);
> ok
SELECT * FROM TEST;
> A
> -
> rows: 0
DROP TABLE TEST;
> ok
...@@ -14,30 +14,22 @@ insert into test values (20), (20), (10); ...@@ -14,30 +14,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -53,30 +45,22 @@ insert into test values (20), (20), (10); ...@@ -53,30 +45,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -92,30 +76,22 @@ insert into test values (20), (20), (10); ...@@ -92,30 +76,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -131,30 +107,22 @@ insert into test values (20), (20), (10); ...@@ -131,30 +107,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -170,30 +138,22 @@ insert into test values (20), (20), (10); ...@@ -170,30 +138,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -209,30 +169,22 @@ insert into test values (20), (20), (10); ...@@ -209,30 +169,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -244,30 +196,22 @@ insert into test values (20), (20), (10); ...@@ -244,30 +196,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -279,30 +223,22 @@ insert into test values (20), (20), (10); ...@@ -279,30 +223,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -314,30 +250,22 @@ insert into test values (20), (20), (10); ...@@ -314,30 +250,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -349,30 +277,22 @@ insert into test values (20), (20), (10); ...@@ -349,30 +277,22 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15
> ------------------
> 15
insert into test values (10); insert into test values (10);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
drop table test; drop table test;
> ok > ok
...@@ -384,30 +304,22 @@ insert into test values (2), (2), (1); ...@@ -384,30 +304,22 @@ insert into test values (2), (2), (1);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2.0
> ---------
> 2.0
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2.0
> ---------
> 2.0
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 1.5
> ------------------
> 1.5
insert into test values (1); insert into test values (1);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 1.5
> ---------
> 1.5
drop table test; drop table test;
> ok > ok
...@@ -419,30 +331,22 @@ insert into test values (2), (2), (1); ...@@ -419,30 +331,22 @@ insert into test values (2), (2), (1);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2.0
> ---------
> 2.0
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2.0
> ---------
> 2.0
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 1.5
> ------------------
> 1.5
insert into test values (1); insert into test values (1);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 1.5
> ---------
> 1.5
drop table test; drop table test;
> ok > ok
...@@ -454,30 +358,22 @@ insert into test values (2), (2), (1); ...@@ -454,30 +358,22 @@ insert into test values (2), (2), (1);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2
> ---------
> 2
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2
> ---------
> 2
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 1.5
> ------------------
> 1.5
insert into test values (1); insert into test values (1);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 1.5
> ---------
> 1.5
drop table test; drop table test;
> ok > ok
...@@ -489,30 +385,22 @@ insert into test values ('20:00:00'), ('20:00:00'), ('10:00:00'); ...@@ -489,30 +385,22 @@ insert into test values ('20:00:00'), ('20:00:00'), ('10:00:00');
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20:00:00
> ---------
> 20:00:00
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20:00:00
> ---------
> 20:00:00
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 15:00:00
> ------------------
> 15:00:00
insert into test values ('10:00:00'); insert into test values ('10:00:00');
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15:00:00
> ---------
> 15:00:00
drop table test; drop table test;
> ok > ok
...@@ -524,30 +412,22 @@ insert into test values ('2000-01-20'), ('2000-01-20'), ('2000-01-10'); ...@@ -524,30 +412,22 @@ insert into test values ('2000-01-20'), ('2000-01-20'), ('2000-01-10');
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-20
> ----------
> 2000-01-20
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-20
> ----------
> 2000-01-20
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 2000-01-15
> ------------------
> 2000-01-15
insert into test values ('2000-01-10'); insert into test values ('2000-01-10');
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-15
> ----------
> 2000-01-15
drop table test; drop table test;
> ok > ok
...@@ -559,30 +439,22 @@ insert into test values ('2000-01-20 20:00:00'), ('2000-01-20 20:00:00'), ('2000 ...@@ -559,30 +439,22 @@ insert into test values ('2000-01-20 20:00:00'), ('2000-01-20 20:00:00'), ('2000
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-20 20:00:00
> -------------------
> 2000-01-20 20:00:00
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-20 20:00:00
> -------------------
> 2000-01-20 20:00:00
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 2000-01-15 15:00:00
> -------------------
> 2000-01-15 15:00:00
insert into test values ('2000-01-10 10:00:00'); insert into test values ('2000-01-10 10:00:00');
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-15 15:00:00
> -------------------
> 2000-01-15 15:00:00
delete from test; delete from test;
> update count: 5 > update count: 5
...@@ -591,9 +463,7 @@ insert into test values ('2000-01-20 20:00:00'), ('2000-01-21 20:00:00'); ...@@ -591,9 +463,7 @@ insert into test values ('2000-01-20 20:00:00'), ('2000-01-21 20:00:00');
> update count: 2 > update count: 2
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-21 08:00:00
> -------------------
> 2000-01-21 08:00:00
drop table test; drop table test;
> ok > ok
...@@ -605,30 +475,22 @@ insert into test values ('2000-01-20 20:00:00+04'), ('2000-01-20 20:00:00+04'), ...@@ -605,30 +475,22 @@ insert into test values ('2000-01-20 20:00:00+04'), ('2000-01-20 20:00:00+04'),
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-20 20:00:00+04
> ----------------------
> 2000-01-20 20:00:00+04
insert into test values (null); insert into test values (null);
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-20 20:00:00+04
> ----------------------
> 2000-01-20 20:00:00+04
select median(distinct v) from test; select median(distinct v) from test;
> MEDIAN(DISTINCT V) >> 2000-01-15 15:00:00+03
> ----------------------
> 2000-01-15 15:00:00+03
insert into test values ('2000-01-10 10:00:00+02'); insert into test values ('2000-01-10 10:00:00+02');
> update count: 1 > update count: 1
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-15 15:00:00+03
> ----------------------
> 2000-01-15 15:00:00+03
delete from test; delete from test;
> update count: 5 > update count: 5
...@@ -637,9 +499,7 @@ insert into test values ('2000-01-20 20:00:00+10:15'), ('2000-01-21 20:00:00-09' ...@@ -637,9 +499,7 @@ insert into test values ('2000-01-20 20:00:00+10:15'), ('2000-01-21 20:00:00-09'
> update count: 2 > update count: 2
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 2000-01-21 08:00:30+00:37
> -------------------------
> 2000-01-21 08:00:30+00:37
drop table test; drop table test;
> ok > ok
...@@ -671,17 +531,13 @@ insert into test values (20), (20), (10); ...@@ -671,17 +531,13 @@ insert into test values (20), (20), (10);
> update count: 3 > update count: 3
select median(v) from test where v <> 20; select median(v) from test where v <> 20;
> MEDIAN(V) >> 10
> ---------
> 10
create index test_idx on test(v asc); create index test_idx on test(v asc);
> ok > ok
select median(v) from test where v <> 20; select median(v) from test where v <> 20;
> MEDIAN(V) >> 10
> ---------
> 10
drop table test; drop table test;
> ok > ok
...@@ -697,9 +553,7 @@ insert into test values (20, 1), (10, 2), (20, 3); ...@@ -697,9 +553,7 @@ insert into test values (20, 1), (10, 2), (20, 3);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
drop table test; drop table test;
> ok > ok
...@@ -712,25 +566,19 @@ create index test_idx on test(v desc); ...@@ -712,25 +566,19 @@ create index test_idx on test(v desc);
> ok > ok
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> null
> ---------
> null
insert into test values (10), (20); insert into test values (10), (20);
> update count: 2 > update count: 2
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 15
> ---------
> 15
insert into test values (20), (10), (20); insert into test values (20), (10), (20);
> update count: 3 > update count: 3
select median(v) from test; select median(v) from test;
> MEDIAN(V) >> 20
> ---------
> 20
drop table test; drop table test;
> ok > ok
......
...@@ -24,3 +24,9 @@ select abs(null) vn, abs(-1) r1, abs(1) r2, abs(0) r3, abs(-0.1) r4, abs(0.1) r5 ...@@ -24,3 +24,9 @@ select abs(null) vn, abs(-1) r1, abs(1) r2, abs(0) r3, abs(-0.1) r4, abs(0.1) r5
> null 1 1 0 0.1 0.1 > null 1 1 0 0.1 0.1
> rows: 1 > rows: 1
select * from table(id int=(1, 2), name varchar=('Hello', 'World')) x order by id;
> ID NAME
> -- -----
> 1 Hello
> 2 World
> rows (ordered): 2
...@@ -87,3 +87,15 @@ select cast(cast(95605327.73 as float) as decimal); ...@@ -87,3 +87,15 @@ select cast(cast(95605327.73 as float) as decimal);
select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary); select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary);
>> 0102030405060708090a0b0c0d0e0f00 >> 0102030405060708090a0b0c0d0e0f00
call cast('null' as uuid);
> exception
select cast('12345678123456781234567812345678' as uuid);
>> 12345678-1234-5678-1234-567812345678
select cast('000102030405060708090a0b0c0d0e0f' as uuid);
>> 00010203-0405-0607-0809-0a0b0c0d0e0f
select -cast(0 as double);
>> 0.0
...@@ -26,3 +26,6 @@ select decode('3', 2.0, 2.0, 3, 3.0); ...@@ -26,3 +26,6 @@ select decode('3', 2.0, 2.0, 3, 3.0);
select decode(4.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 9.0); select decode(4.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 9.0);
>> 4.0 >> 4.0
select decode(1, 1, '1', 1, '11') from dual;
>> 1
...@@ -2,3 +2,44 @@ ...@@ -2,3 +2,44 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html). -- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group -- Initial Developer: H2 Group
-- --
select * from table(a int=(1)), table(b int=(2));
> A B
> - -
> 1 2
> rows: 1
create table test as select * from table(id int=(1, 2, 3));
> ok
SELECT * FROM (SELECT * FROM TEST) ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
SELECT * FROM (SELECT * FROM TEST) x ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
drop table test;
> ok
explain select * from table(id int = (1, 2), name varchar=('Hello', 'World'));
> PLAN
> -----------------------------------------------------------------------------------------------------
> SELECT TABLE.ID, TABLE.NAME FROM TABLE(ID INT=(1, 2), NAME VARCHAR=('Hello', 'World')) /* function */
> rows: 1
select * from table(id int=(1, 2), name varchar=('Hello', 'World')) x order by id;
> ID NAME
> -- -----
> 1 Hello
> 2 World
> rows (ordered): 2
...@@ -16,7 +16,7 @@ select length(curtime())>=8 c1, length(current_time())>=8 c2, substring(curtime( ...@@ -16,7 +16,7 @@ select length(curtime())>=8 c1, length(current_time())>=8 c2, substring(curtime(
> rows: 1 > rows: 1
select length(now())>20 c1, length(current_timestamp())>18 c2, length(now(0))>18 c3, length(now(2))>18 c4 from test; select length(now())>18 c1, length(current_timestamp())>18 c2, length(now(0))>18 c3, length(now(2))>18 c4 from test;
> C1 C2 C3 C4 > C1 C2 C3 C4
> ---- ---- ---- ---- > ---- ---- ---- ----
> TRUE TRUE TRUE TRUE > TRUE TRUE TRUE TRUE
......
...@@ -15,18 +15,6 @@ select * from test where id in (select id from test order by 'x'); ...@@ -15,18 +15,6 @@ select * from test where id in (select id from test order by 'x');
drop table test; drop table test;
> ok > ok
select abs(cast(0.0 as double)) x;
> X
> ---
> 0.0
> rows: 1
select * from table(a int=(1)), table(b int=(2));
> A B
> - -
> 1 2
> rows: 1
select x, x in(2, 3) i from system_range(1, 2) group by x; select x, x in(2, 3) i from system_range(1, 2) group by x;
> X I > X I
> - ----- > - -----
...@@ -144,12 +132,6 @@ select case seq.nextval when 2 then 'two' when 3 then 'three' when 1 then 'one' ...@@ -144,12 +132,6 @@ select case seq.nextval when 2 then 'two' when 3 then 'three' when 1 then 'one'
drop sequence seq; drop sequence seq;
> ok > ok
select decode(1, 1, '1', 1, '11') r from dual;
> R
> -
> 1
> rows: 1
create table test(x int); create table test(x int);
> ok > ok
...@@ -236,9 +218,6 @@ update test set pid = 1 where id = 2; ...@@ -236,9 +218,6 @@ update test set pid = 1 where id = 2;
drop table test; drop table test;
> ok > ok
call cast('null' as uuid);
> exception
create table test(name varchar(255)); create table test(name varchar(255));
> ok > ok
...@@ -420,12 +399,6 @@ explain select -cast(0 as real), -cast(0 as double); ...@@ -420,12 +399,6 @@ explain select -cast(0 as real), -cast(0 as double);
> SELECT 0.0, 0.0 FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX */ > SELECT 0.0, 0.0 FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX */
> rows: 1 > rows: 1
select -cast(0 as double) nz;
> NZ
> ---
> 0.0
> rows: 1
select () empty; select () empty;
> EMPTY > EMPTY
> ----- > -----
...@@ -1400,28 +1373,6 @@ DROP ROLE Y; ...@@ -1400,28 +1373,6 @@ DROP ROLE Y;
DROP ROLE X; DROP ROLE X;
> ok > ok
create table test as select * from table(id int=(1, 2, 3));
> ok
SELECT * FROM (SELECT * FROM TEST) ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
SELECT * FROM (SELECT * FROM TEST) x ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
drop table test;
> ok
select top sum(1) 0 from dual; select top sum(1) 0 from dual;
> exception > exception
...@@ -2064,12 +2015,6 @@ select * from V, C where V.V = C.C; ...@@ -2064,12 +2015,6 @@ select * from V, C where V.V = C.C;
drop table A, B, C, V cascade; drop table A, B, C, V cascade;
> ok > ok
explain select * from table(id int = (1, 2), name varchar=('Hello', 'World'));
> PLAN
> -----------------------------------------------------------------------------------------------------
> SELECT TABLE.ID, TABLE.NAME FROM TABLE(ID INT=(1, 2), NAME VARCHAR=('Hello', 'World')) /* function */
> rows: 1
CREATE TABLE TEST(ID INT PRIMARY KEY, FLAG BOOLEAN, NAME VARCHAR); CREATE TABLE TEST(ID INT PRIMARY KEY, FLAG BOOLEAN, NAME VARCHAR);
> ok > ok
...@@ -2275,13 +2220,6 @@ select (1, 2); ...@@ -2275,13 +2220,6 @@ select (1, 2);
> (1, 2) > (1, 2)
> rows: 1 > rows: 1
select * from table(id int=(1, 2), name varchar=('Hello', 'World')) x order by id;
> ID NAME
> -- -----
> 1 Hello
> 2 World
> rows (ordered): 2
create table array_test(x array); create table array_test(x array);
> ok > ok
...@@ -2303,15 +2241,6 @@ select * from (select 1), (select 2); ...@@ -2303,15 +2241,6 @@ select * from (select 1), (select 2);
> 1 2 > 1 2
> rows: 1 > rows: 1
CREATE TABLE TEST(A VARCHAR, B VARCHAR, C VARCHAR AS LOWER(A));
> ok
ALTER TABLE TEST DROP COLUMN B;
> ok
DROP TABLE TEST;
> ok
create table t1(c1 int, c2 int); create table t1(c1 int, c2 int);
> ok > ok
...@@ -2790,18 +2719,6 @@ drop view address_view; ...@@ -2790,18 +2719,6 @@ drop view address_view;
drop table address; drop table address;
> ok > ok
select cast('12345678123456781234567812345678' as uuid);
> '12345678-1234-5678-1234-567812345678'
> --------------------------------------
> 12345678-1234-5678-1234-567812345678
> rows: 1
select cast('000102030405060708090a0b0c0d0e0f' as uuid);
> '00010203-0405-0607-0809-0a0b0c0d0e0f'
> --------------------------------------
> 00010203-0405-0607-0809-0a0b0c0d0e0f
> rows: 1
CREATE ALIAS PARSE_INT2 FOR "java.lang.Integer.parseInt(java.lang.String, int)"; CREATE ALIAS PARSE_INT2 FOR "java.lang.Integer.parseInt(java.lang.String, int)";
> ok > ok
......
...@@ -32,7 +32,8 @@ public class MergeDocs { ...@@ -32,7 +32,8 @@ public class MergeDocs {
String[] pages = { "quickstart.html", "installation.html", String[] pages = { "quickstart.html", "installation.html",
"tutorial.html", "features.html", "performance.html", "tutorial.html", "features.html", "performance.html",
"advanced.html", "grammar.html", "functions.html", "advanced.html", "grammar.html", "functions.html",
"datatypes.html", "build.html", "history.html", "faq.html" }; "datatypes.html", "systemtables.html",
"build.html", "history.html", "faq.html" };
StringBuilder buff = new StringBuilder(); StringBuilder buff = new StringBuilder();
for (String fileName : pages) { for (String fileName : pages) {
String text = getContent(fileName); String text = getContent(fileName);
...@@ -42,6 +43,7 @@ public class MergeDocs { ...@@ -42,6 +43,7 @@ public class MergeDocs {
text = disableRailroads(text); text = disableRailroads(text);
text = removeHeaderFooter(fileName, text); text = removeHeaderFooter(fileName, text);
text = fixLinks(text); text = fixLinks(text);
text = fixTableBorders(text);
buff.append(text); buff.append(text);
} }
String finalText = buff.toString(); String finalText = buff.toString();
...@@ -102,6 +104,12 @@ public class MergeDocs { ...@@ -102,6 +104,12 @@ public class MergeDocs {
.replaceAll("href=\"tutorial.html\"", "href=\"#tutorial_index\""); .replaceAll("href=\"tutorial.html\"", "href=\"#tutorial_index\"");
} }
private static String fixTableBorders(String text) {
return text
.replaceAll("<table class=\"main\">",
"<table class=\"main\" border=\"1\" cellpadding=\"5\" cellspacing=\"0\">");
}
private static String getContent(String fileName) throws Exception { private static String getContent(String fileName) throws Exception {
File file = new File(BASE_DIR, fileName); File file = new File(BASE_DIR, fileName);
int length = (int) file.length(); int length = (int) file.length();
......
...@@ -766,4 +766,4 @@ interpolated thead ...@@ -766,4 +766,4 @@ interpolated thead
die weekdiff osx subprocess dow proleptic microsecond microseconds divisible cmp denormalized suppressed saturated mcs die weekdiff osx subprocess dow proleptic microsecond microseconds divisible cmp denormalized suppressed saturated mcs
london dfs weekdays intermittent looked msec tstz africa monrovia asia tokyo weekday joi callers multipliers ucn london dfs weekdays intermittent looked msec tstz africa monrovia asia tokyo weekday joi callers multipliers ucn
openoffice organize libre openoffice organize libre systemtables gmane sea borders
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论