提交 90fc7377 authored 作者: Stéphane Eintrazi's avatar Stéphane Eintrazi

Merge branch 'master' into scay-issue#935

......@@ -6,8 +6,11 @@
SELECT [ TOP term ] [ DISTINCT | ALL ] selectExpression [,...]
FROM tableExpression [,...] [ WHERE expression ]
[ GROUP BY expression [,...] ] [ HAVING expression ]
[ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ] [ ORDER BY order [,...] ]
[ { LIMIT expression [ OFFSET expression ] [ SAMPLE_SIZE rowCountInt ] } | { [ OFFSET expression { ROW | ROWS } ] [ { FETCH { FIRST | NEXT } expression { ROW | ROWS } ONLY } ] } ]
[ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ]
[ ORDER BY order [,...] ]
[ { LIMIT expression [ OFFSET expression ] [ SAMPLE_SIZE rowCountInt ] }
| { [ OFFSET expression { ROW | ROWS } ]
[ { FETCH { FIRST | NEXT } expression { ROW | ROWS } ONLY } ] } ]
[ FOR UPDATE ]
","
Selects data from a table or multiple tables.
......@@ -44,7 +47,8 @@ SELECT * FROM (SELECT ID, COUNT(*) FROM TEST
"Commands (DML)","INSERT","
INSERT INTO tableName
{ [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select } } |
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...]
| [ DIRECT ] [ SORTED ] select } } |
{ SET { columnName = { DEFAULT | expression } } [,...] }
","
Inserts a new row / new rows into a table.
......@@ -99,7 +103,8 @@ CALL 15*25
"
"Commands (DML)","EXPLAIN","
EXPLAIN { [ PLAN FOR ] | ANALYZE } { select | insert | update | delete | merge }
EXPLAIN { [ PLAN FOR ] | ANALYZE }
{ select | insert | update | delete | merge }
","
Shows the execution plan for a statement.
When using EXPLAIN ANALYZE, the statement is actually executed, and the query plan
......@@ -269,7 +274,9 @@ ALTER SCHEMA TEST RENAME TO PRODUCTION
"
"Commands (DDL)","ALTER SEQUENCE","
ALTER SEQUENCE [ IF EXISTS ] sequenceName [ RESTART WITH long ] [ INCREMENT BY long ]
ALTER SEQUENCE [ IF EXISTS ] sequenceName
[ RESTART WITH long ]
[ INCREMENT BY long ]
[ MINVALUE long | NOMINVALUE | NO MINVALUE ]
[ MAXVALUE long | NOMAXVALUE | NO MAXVALUE ]
[ CYCLE long | NOCYCLE | NO CYCLE ]
......@@ -307,7 +314,8 @@ ALTER TABLE TEST ADD CONSTRAINT NAME_UNIQUE UNIQUE(NAME)
"
"Commands (DDL)","ALTER TABLE RENAME CONSTRAINT","
ALTER TABLE [ IF EXISTS ] tableName RENAME oldConstraintName TO newConstraintName
ALTER TABLE [ IF EXISTS ] tableName RENAME oldConstraintName
TO newConstraintName
","
Renames a constraint.
This command commits an open transaction in this connection.
......@@ -364,7 +372,8 @@ ALTER TABLE TEST ALTER COLUMN NAME SET INVISIBLE;
"
"Commands (DDL)","ALTER TABLE DROP COLUMN","
ALTER TABLE [ IF EXISTS ] tableName DROP COLUMN [ IF EXISTS ] ( columnName [,...] )
ALTER TABLE [ IF EXISTS ] tableName DROP COLUMN [ IF EXISTS ]
( columnName [,...] )
","
Removes column(s) from a table.
This command commits an open transaction in this connection.
......@@ -374,7 +383,8 @@ ALTER TABLE TEST DROP COLUMN NAME1, NAME2
"
"Commands (DDL)","ALTER TABLE DROP CONSTRAINT","
ALTER TABLE [ IF EXISTS ] tableName DROP { CONSTRAINT [ IF EXISTS ] constraintName | PRIMARY KEY }
ALTER TABLE [ IF EXISTS ] tableName DROP
{ CONSTRAINT [ IF EXISTS ] constraintName | PRIMARY KEY }
","
Removes a constraint or a primary key from a table.
This command commits an open transaction in this connection.
......@@ -626,11 +636,13 @@ be the resource name (for example ""java:comp/env/jdbc/Test"").
Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
CREATE LINKED TABLE LINK('org.h2.Driver', 'jdbc:h2:test2', 'sa', 'sa', 'TEST');
CREATE LINKED TABLE LINK('org.h2.Driver', 'jdbc:h2:test2',
'sa', 'sa', 'TEST');
CREATE LINKED TABLE LINK('', 'jdbc:h2:test2', 'sa', 'sa',
'(SELECT * FROM TEST WHERE ID>0)');
CREATE LINKED TABLE LINK('javax.naming.InitialContext',
'java:comp/env/jdbc/Test', NULL, NULL, '(SELECT * FROM TEST WHERE ID>0)');
'java:comp/env/jdbc/Test', NULL, NULL,
'(SELECT * FROM TEST WHERE ID>0)');
"
"Commands (DDL)","CREATE ROLE","
......@@ -643,7 +655,8 @@ CREATE ROLE READONLY
"
"Commands (DDL)","CREATE SCHEMA","
CREATE SCHEMA [ IF NOT EXISTS ] name [ AUTHORIZATION ownerUserName ]
CREATE SCHEMA [ IF NOT EXISTS ] name
[ AUTHORIZATION ownerUserName ]
[ WITH tableEngineParamName [,...] ]
","
Creates a new schema. If no owner is specified, the current user is used. The
......@@ -658,7 +671,8 @@ CREATE SCHEMA TEST_SCHEMA AUTHORIZATION SA
"
"Commands (DDL)","CREATE SEQUENCE","
CREATE SEQUENCE [ IF NOT EXISTS ] newSequenceName [ START WITH long ]
CREATE SEQUENCE [ IF NOT EXISTS ] newSequenceName
[ START WITH long ]
[ INCREMENT BY long ]
[ MINVALUE long | NOMINVALUE | NO MINVALUE ]
[ MAXVALUE long | NOMAXVALUE | NO MAXVALUE ]
......@@ -722,9 +736,12 @@ CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))
"
"Commands (DDL)","CREATE TRIGGER","
CREATE TRIGGER [ IF NOT EXISTS ] newTriggerName { BEFORE | AFTER | INSTEAD OF }
{ INSERT | UPDATE | DELETE | SELECT | ROLLBACK } [,...] ON tableName [ FOR EACH ROW ]
[ QUEUE int ] [ NOWAIT ] { CALL triggeredClassName | AS sourceCodeString }
CREATE TRIGGER [ IF NOT EXISTS ] newTriggerName
{ BEFORE | AFTER | INSTEAD OF }
{ INSERT | UPDATE | DELETE | SELECT | ROLLBACK }
[,...] ON tableName [ FOR EACH ROW ]
[ QUEUE int ] [ NOWAIT ]
{ CALL triggeredClassName | AS sourceCodeString }
","
Creates a new trigger.
The trigger class must be public and implement ""org.h2.api.Trigger"".
......@@ -1219,7 +1236,8 @@ SET BUILTIN_ALIAS_OVERRIDE TRUE
"Commands (Other)","SET COLLATION","
SET [ DATABASE ] COLLATION
{ OFF | collationName [ STRENGTH { PRIMARY | SECONDARY | TERTIARY | IDENTICAL } ] }
{ OFF | collationName
[ STRENGTH { PRIMARY | SECONDARY | TERTIARY | IDENTICAL } ] }
","
Sets the collation used for comparing strings.
This command can only be executed if there are no tables defined.
......@@ -2206,7 +2224,8 @@ DATE '2004-12-31'
"
"Other Grammar","Decimal","
[ + | - ] { { number [ . number ] } | { . number } } [ E [ + | - ] expNumber [...] ] ]
[ + | - ] { { number [ . number ] } | { . number } }
[ E [ + | - ] expNumber [...] ] ]
","
A decimal number with fixed precision and scale.
Internally, ""java.lang.BigDecimal"" is used.
......@@ -2388,7 +2407,8 @@ FOREIGN KEY(ID) REFERENCES TEST(ID) ON UPDATE CASCADE
"
"Other Grammar","Script Compression Encryption","
[ COMPRESSION { DEFLATE | LZF | ZIP | GZIP } ] [ CIPHER cipher PASSWORD string ]
[ COMPRESSION { DEFLATE | LZF | ZIP | GZIP } ]
[ CIPHER cipher PASSWORD string ]
","
The compression and encryption algorithm to use for script files.
When using encryption, only DEFLATE and LZF are supported.
......@@ -2638,7 +2658,8 @@ DATE
"
"Data Types","TIMESTAMP Type","
{ TIMESTAMP [ ( precisionInt ) ] [ WITHOUT TIME ZONE ] | DATETIME | SMALLDATETIME }
{ TIMESTAMP [ ( precisionInt ) ] [ WITHOUT TIME ZONE ]
| DATETIME | SMALLDATETIME }
","
The timestamp data type. The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
Stored internally as a BCD-encoded date, and nanoseconds since midnight.
......@@ -2669,7 +2690,8 @@ TIMESTAMP WITH TIME ZONE
"
"Data Types","BINARY Type","
{ BINARY | VARBINARY | LONGVARBINARY | RAW | BYTEA } [ ( precisionInt ) ]
{ BINARY | VARBINARY | LONGVARBINARY | RAW | BYTEA }
[ ( precisionInt ) ]
","
Represents a byte array. For very long arrays, use BLOB.
The maximum size is 2 GB, but the whole object is kept in
......@@ -2750,7 +2772,8 @@ CHAR(10)
"
"Data Types","BLOB Type","
{ BLOB | TINYBLOB | MEDIUMBLOB | LONGBLOB | IMAGE | OID } [ ( precisionInt ) ]
{ BLOB | TINYBLOB | MEDIUMBLOB | LONGBLOB | IMAGE | OID }
[ ( precisionInt ) ]
","
Like BINARY, but intended for very large values such as files or images. Unlike
when using BINARY, large objects are not kept fully in-memory. Use
......@@ -2763,7 +2786,8 @@ BLOB
"
"Data Types","CLOB Type","
{ CLOB | TINYTEXT | TEXT | MEDIUMTEXT | LONGTEXT | NTEXT | NCLOB } [ ( precisionInt ) ]
{ CLOB | TINYTEXT | TEXT | MEDIUMTEXT | LONGTEXT | NTEXT | NCLOB }
[ ( precisionInt ) ]
","
CLOB is like VARCHAR, but intended for very large values. Unlike when using
VARCHAR, large CLOB objects are not kept fully in-memory; instead, they are streamed.
......
......@@ -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.
</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>
......@@ -120,8 +120,8 @@ The primary packages of interest are:
<h2 id="transaction">Undo log, redo log, and transactions layer</h2>
<p>
We have a transaction log, which is shared among all sessions. See also
http://en.wikipedia.org/wiki/Transaction_log
http://h2database.com/html/grammar.html#set_log
<a href="https://en.wikipedia.org/wiki/Transaction_log">https://en.wikipedia.org/wiki/Transaction_log</a>
<a href="http://h2database.com/html/grammar.html#set_log">http://h2database.com/html/grammar.html#set_log</a>
</p>
<p>
We also have an undo log, which is per session, to undo an operation (an update that fails for example)
......
......@@ -18,7 +18,7 @@ Build
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<!-- } -->
<h1>Build</h1>
<h1 id="build_index">Build</h1>
<a href="#portability">
Portability</a><br />
<a href="#environment">
......@@ -60,9 +60,9 @@ To use this database, it is not required to install this software however.
</li><li><a href="http://www.eclipse.org">Eclipse</a>
</li><li>Eclipse Plugins:
<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>
</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://nsis.sourceforge.net">NSIS</a> (Nullsoft Scriptable Install System)
</li><li><a href="http://maven.apache.org">Maven</a>
......@@ -88,8 +88,11 @@ You will get a list of targets. If you want to build the <code>jar</code> file,
build jar
</pre>
<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>
<pre>
./build.sh -
</pre>
<h3>Switching the Source Code</h3>
<p>
......@@ -148,7 +151,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>
<p>
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:
</p>
<pre>
......@@ -246,7 +249,7 @@ If you'd like to contribute bug fixes or new features, please consider the follo
<p>
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
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:
</p>
<p>
......@@ -263,17 +266,16 @@ or if you have a feature request:
<ul><li>For bug reports, please provide a
<a href="http://sscce.org/">short, self contained, correct (compilable), example</a> of the problem.
</li><li>Feature requests are always welcome, even if the feature is already on the
<a href="roadmap.html">roadmap</a>. Your mail will help prioritize feature requests.
<a href="http://www.h2database.com/html/roadmap.html">roadmap</a>. Your mail will help prioritize feature requests.
If you urgently need a feature, consider <a href="#providing_patches">providing a patch</a>.
</li><li>Before posting problems, check the
<a href="faq.html">FAQ</a> and do a <a href="http://google.com">Google search</a>.
</li><li>When got an unexpected exception, please try the
<a href="sourceError.html">Error Analyzer tool</a>. If this doesn't help,
<a href="http://www.h2database.com/html/sourceError.html">Error Analyzer tool</a>. If this doesn't help,
please report the problem, including the complete error message and stack trace,
and the root cause stack trace(s).
</li><li>When sending source code, please use a public web clipboard such as
<a href="http://pastebin.com">Pastebin</a>,
<a href="http://cl1p.net">Cl1p</a>, or
<a href="https://pastebin.com/">Pastebin</a> or
<a href="http://www.mysticpaste.com/new">Mystic Paste</a>
to avoid formatting problems.
Please keep test cases as simple and short as possible,
......@@ -285,8 +287,8 @@ or if you have a feature request:
Please use the JDBC API and no external tools or libraries.
The test should include all required initialization code, and
should be started with the main method.
</li><li>For large attachments, use a public temporary storage such as
<a href="http://rapidshare.com">Rapidshare</a>.
</li><li>For large attachments, use a public storage such as
<a href="https://www.google.com/drive/">Google Drive</a>.
</li><li>Google Group versus issue tracking:
Use the
<a href="http://groups.google.com/group/h2-database">Google Group</a>
......
......@@ -18,7 +18,7 @@ Data Types
<!-- } -->
<h1>Data Types</h1>
<h2>Index</h2>
<h2 id="datatypes_index">Index</h2>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="dataTypes">
......@@ -52,7 +52,7 @@ syntax-end -->
<!-- railroad-end -->
<c:forEach var="item" items="dataTypes">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<h2 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h2>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
${item.syntax}
......
......@@ -17,7 +17,7 @@ Frequently Asked Questions
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<!-- } -->
<h1>Frequently Asked Questions</h1>
<h1 id="faq_index">Frequently Asked Questions</h1>
<a href="#support">
I Have a Problem or Feature Request</a><br />
......@@ -69,7 +69,7 @@ Here is the list of known and confirmed issues:
database to a SQL script using the old timezone, and create a new database in the new
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>.
See <a href="https://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
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
......@@ -172,7 +172,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:
</p>
<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>Cluster mode, 2-phase commit, savepoints.
</li><li>Fulltext search.
......@@ -245,10 +245,10 @@ return <code>X</code>. What's wrong?
This is not a bug. According the the JDBC specification, the method
<code>ResultSetMetaData.getColumnName()</code> should return the name of the column
and not the alias name. If you need the alias name, use
<a href="http://java.sun.com/javase/6/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel(int)"><code>ResultSetMetaData.getColumnLabel()</code></a>.
<a href="https://docs.oracle.com/javase/7/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel(int)"><code>ResultSetMetaData.getColumnLabel()</code></a>.
Some other database don't work like this yet (they don't follow the JDBC specification).
If you need compatibility with those databases, use the <a href="features.html#compatibility">Compatibility Mode</a>,
or append <a href="../javadoc/org/h2/engine/DbSettings.html#ALIAS_COLUMN_NAME"><code>;ALIAS_COLUMN_NAME=TRUE</code></a> to the database URL.
or append <a href="http://www.h2database.com/javadoc/org/h2/engine/DbSettings.html#ALIAS_COLUMN_NAME"><code>;ALIAS_COLUMN_NAME=TRUE</code></a> to the database URL.
</p>
<p>
This also applies to DatabaseMetaData calls that return a result set.
......@@ -265,7 +265,7 @@ return a <code>java.lang.Float</code>. What's wrong?
This is not a bug. According the the JDBC specification, the JDBC data type <code>FLOAT</code>
is equivalent to <code>DOUBLE</code>, and both are mapped to <code>java.lang.Double</code>.
See also
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/getstart/mapping.html#1055162">
<a href="https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html#1055162">
Mapping SQL and Java Types - 8.3.10 FLOAT</a>.</p>
<p>Use REAL or FLOAT(24) data type for <code>java.lang.Float</code> values.</p>
......@@ -285,7 +285,7 @@ Please start with small patches. That could be adding a test case to improve the
<a href="build.html#automated">code coverage</a> (the target code coverage for this project is 90%, higher is better).
You will have to <a href="build.html">develop, build and run the tests</a>.
Once you are familiar with the code, you could implement missing features from the
<a href="roadmap.html">feature request list</a>.
<a href="http://www.h2database.com/html/roadmap.html">feature request list</a>.
I suggest to start with very small features that are easy to implement.
Keep in mind to provide test cases as well.
</p>
......
......@@ -163,8 +163,8 @@ This comparison is based on
H2 1.3,
<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://mysql.com">MySQL 5.5</a>,
<a href="http://www.postgresql.org">PostgreSQL 9.0</a>.
<a href="https://www.mysql.com/">MySQL 5.5</a>,
<a href="https://www.postgresql.org/">PostgreSQL 9.0</a>.
</p>
<table class="main">
<tr>
......@@ -370,7 +370,7 @@ H2 1.3,
*8 Derby doesn't support standard compliant information schema tables.<br />
*9 When using MVCC (multi version concurrency).<br />
*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 />
*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 />
......@@ -378,20 +378,10 @@ H2 1.3,
*15 Derby and H2 support <code>ROW_NUMBER() OVER()</code>.
</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>
<p>
For a list of applications that work with or use H2, see:
<a href="links.html">Links</a>.
<a href="http://www.h2database.com/html/links.html">Links</a>.
</p>
<h2 id="connection_modes">Connection Modes</h2>
......@@ -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
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>
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>
<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
facility as the application, for example Log4j. To do that, this database support SLF4J.
</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.
SLF4J supports implementations such as Logback, Log4j, Jakarta Commons Logging (JCL),
Java logging, x4juli, and Simple Log.
......
......@@ -78,15 +78,16 @@ translate -->
<a href="grammar.html">SQL Grammar</a><br />
<a href="functions.html">Functions</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="../h2.pdf">PDF (1 MB)</a><br />
<br />
<b>Support</b><br />
<a href="faq.html">FAQ</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="http://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-database">Google Group (English)</a><br />
<a href="https://groups.google.co.jp/group/h2-database-jp">Google Group (Japanese)</a><br />
<a href="https://groups.google.com/group/h2-cn">Google Group (Chinese)</a><br />
<br />
<b>Appendix</b><br />
<a href="history.html">History &amp; Roadmap</a><br />
......
......@@ -164,7 +164,92 @@ syntax-end -->
<p>Click on the header to switch between railroad diagram and BNF.</p>
<!-- railroad-end -->
<c:forEach var="item" items="functionsAll">
<h2>Aggregate Functions</h2>
<c:forEach var="item" items="functionsAggregate">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
${item.syntax}
</pre>
<div name="railroad">
${item.railroad}
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
${item.syntax}
</pre>
syntax-end -->
<p>${item.text}</p>
<p>Example:</p>
<p class="notranslate">${item.example}</p>
</c:forEach>
<h2>Numeric Functions</h2>
<c:forEach var="item" items="functionsNumeric">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
${item.syntax}
</pre>
<div name="railroad">
${item.railroad}
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
${item.syntax}
</pre>
syntax-end -->
<p>${item.text}</p>
<p>Example:</p>
<p class="notranslate">${item.example}</p>
</c:forEach>
<h2>String Functions</h2>
<c:forEach var="item" items="functionsString">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
${item.syntax}
</pre>
<div name="railroad">
${item.railroad}
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
${item.syntax}
</pre>
syntax-end -->
<p>${item.text}</p>
<p>Example:</p>
<p class="notranslate">${item.example}</p>
</c:forEach>
<h2>Time and Date Functions</h2>
<c:forEach var="item" items="functionsTimeDate">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
${item.syntax}
</pre>
<div name="railroad">
${item.railroad}
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
${item.syntax}
</pre>
syntax-end -->
<p>${item.text}</p>
<p>Example:</p>
<p class="notranslate">${item.example}</p>
</c:forEach>
<h2>System Functions</h2>
<c:forEach var="item" items="functionsSystem">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
......
......@@ -18,7 +18,7 @@ SQL Grammar
<!-- } -->
<h1>SQL Grammar</h1>
<h2>Index</h2>
<h2 id="grammar_index">Index</h2>
<h3>Commands (Data Manipulation)</h3>
<!-- syntax-start
<p class="notranslate">
......@@ -159,18 +159,13 @@ syntax-end -->
</table>
<!-- 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 -->
<h2>Details</h2>
<p>Click on the header to switch between railroad diagram and BNF.</p>
<!-- railroad-end -->
<c:forEach var="item" items="commands">
<h2>Commands (Data Manipulation)</h2>
<c:forEach var="item" items="commandsDML">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
......@@ -191,7 +186,8 @@ syntax-end -->
${item.example}</p>
</c:forEach>
<c:forEach var="item" items="datetimeFields">
<h2>Commands (Data Definition)</h2>
<c:forEach var="item" items="commandsDDL">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
......@@ -212,10 +208,16 @@ syntax-end -->
${item.example}</p>
</c:forEach>
<c:forEach var="item" items="otherGrammar">
<h2>Commands (Other)</h2>
<c:forEach var="item" items="commandsOther">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
${item.syntax}
</pre>
<div name="railroad">
${item.railroad}
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
......@@ -224,34 +226,47 @@ ${item.syntax}
syntax-end -->
<p>${item.text}</p>
<p>Example:</p>
<p class="notranslate">${item.example}</p>
<p class="notranslate">
${item.example}</p>
</c:forEach>
<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>
<h2>Datetime fields</h2>
<c:forEach var="item" items="datetimeFields">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
${item.syntax}
</pre>
<div name="railroad">
${item.railroad}
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
${item.syntax}
</pre>
syntax-end -->
<p>${item.text}</p>
<p>Example:</p>
<p class="notranslate">
${item.example}</p>
</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>
<h2>Other Grammar</h2>
<c:forEach var="item" items="otherGrammar">
<h3 id="${item.link}" class="notranslate" onclick="switchBnf(this)">${item.topic}</h3>
<!-- railroad-start -->
${item.railroad}
<!-- railroad-end -->
<!-- syntax-start
<pre>
SELECT X FROM SYSTEM_RANGE(1, 10);
${item.syntax}
</pre>
syntax-end -->
<p>${item.text}</p>
<p>Example:</p>
<p class="notranslate">${item.example}</p>
</c:forEach>
<!--[if lte IE 7]><script language="javascript">switchBnf(null);</script><![endif]-->
......
......@@ -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>.
</p><p>
<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>
to get informed about new releases.
Your email address is only used in this context.
......
......@@ -5,17 +5,17 @@
*/
td, input, select, textarea, body, code, pre, td, th {
font: 9pt Tahoma, Arial, Helvetica, sans-serif;
font: 14pt Tahoma, Arial, Helvetica, sans-serif;
font-weight: normal;
}
h1, h2, h3, h4, h5 {
font: 9pt Arial, Helvetica, sans-serif;
font: 14pt Arial, Helvetica, sans-serif;
font-weight: bold;
}
td, input, select, textarea, body, code, pre {
font-size: 9pt;
font-size: 14pt;
}
pre {
......@@ -32,26 +32,27 @@ body {
margin: 0px;
}
h1 {
h1, p.title {
background-color: #0000bb;
padding: 2px 4px 2px 4px;
color: #fff;
font-size: 15pt;
font-size: 24pt;
font-weight: bold;
line-height: normal;
}
h2 {
font-size: 13pt;
font-size: 18pt;
margin-top: 1.5em;
}
h3 {
font-size: 11pt;
font-size: 16pt;
margin-top: 1.5em;
}
h4 {
font-size: 9pt;
font-size: 14pt;
margin-top: 1.5em;
}
......@@ -69,7 +70,7 @@ table {
}
th {
font-size: 9pt;
font-size: 14pt;
font-weight: normal;
text-align: left;
background-color: #ece9d8;
......@@ -79,7 +80,7 @@ th {
td {
background-color: #ffffff;
font-size: 9pt;
font-size: 14pt;
text-align: left;
vertical-align: top;
border: 1px solid #aca899;
......
<!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>
......@@ -18,7 +18,7 @@ Tutorial
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<!-- } -->
<h1>Tutorial</h1>
<h1 id="tutorial_index">Tutorial</h1>
<a href="#tutorial_starting_h2_console">
Starting and Using the H2 Console</a><br />
<a href="#console_syntax">
......@@ -564,11 +564,7 @@ Shutting down a TCP server can be protected using the option <code>-tcpPassword<
<h2 id="using_hibernate">Using Hibernate</h2>
<p>
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.
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.
or the native H2 Dialect.
</p>
<p>
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
<h2 id="using_netbeans">Using H2 within NetBeans</h2>
<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:
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>.
......@@ -1154,9 +1146,9 @@ Example permission tags:
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.
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,
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
one using <code>DriverManager.getConnection()</code>.The build-in connection pool is used as follows:
</p>
......@@ -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.
</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>
<p>
The standard H2 jar can be dropped in as a bundle in an OSGi container.
......
......@@ -29,6 +29,10 @@ sub H2Pdf
HeadingStyle.BreakType = 3 ' Insert Page Break Before
HeadingStyle.ParaKeepTogether = false
For i = 1 to 4
ParagraphStyles.getByName("Heading " + i).OutlineLevel = i
Next
images = document.GraphicObjects
For i = 0 to images.getCount() - 1
image = images.getByIndex(i)
......@@ -88,11 +92,15 @@ sub H2Pdf
dim linkStart(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)
x = DimArray(5)
x = Array(linkStart, oLevel(0), oLevel(1), oLevel(2), oLevel(3), linkEnd)
old = oLevel(0)
bound = UBound(oLevel)
x = DimArray(bound + 2)
x(0) = linkStart
for j = 0 to bound
x(j + 1) = oLevel(j)
next
x(bound + 2) = linkEnd
linkStart(0).Name = "TokenType"
linkStart(0).Value = "TokenHyperlinkStart"
linkStart(0).Handle = -1
......
......@@ -1625,6 +1625,10 @@ public class Parser {
command.setIndexName(indexName);
ifExists = readIfExists(ifExists);
command.setIfExists(ifExists);
//Support for MySQL: DROP INDEX index_name ON tbl_name
if(readIf("ON")) {
readIdentifierWithSchema();
}
return command;
} else if (readIf("USER")) {
boolean ifExists = readIfExists(false);
......
......@@ -398,6 +398,8 @@ public class TestCompatibility extends TestBase {
// 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 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 = getConnection("compatibility");
......
......@@ -390,6 +390,26 @@ public class TestScript extends TestBase {
head[i] = label;
}
rs.close();
String line = readLine();
putBack = line;
if (line != null && line.startsWith(">> ")) {
switch (result.size()) {
case 0:
writeResult(sql, "<no result>", null, ">> ");
return;
case 1:
String[] row = result.get(0);
if (row.length == 1) {
writeResult(sql, row[0], null, ">> ");
} else {
writeResult(sql, "<row with " + row.length + " values>", null, ">> ");
}
return;
default:
writeResult(sql, "<" + result.size() + " rows>", null, ">> ");
return;
}
}
writeResult(sql, format(head, max), null);
writeResult(sql, format(null, max), null);
String[] array = new String[result.size()];
......@@ -434,10 +454,13 @@ public class TestScript extends TestBase {
writeResult(sql, "exception", e);
}
private void writeResult(String sql, String s, SQLException e)
throws Exception {
private void writeResult(String sql, String s, SQLException e) throws Exception {
writeResult(sql, s, e, "> ");
}
private void writeResult(String sql, String s, SQLException e, String prefix) throws Exception {
assertKnownException(sql, e);
s = ("> " + s).trim();
s = (prefix + s).trim();
String compare = readLine();
if (compare != null && compare.startsWith(">")) {
if (!compare.equals(s)) {
......
......@@ -80,9 +80,7 @@ INSERT INTO TEST(T0) VALUES ('23:59:59.999999999');
> update count: 1
SELECT T0 FROM TEST;
> T0
> ------------------
> 23:59:59.999999999
>> 23:59:59.999999999
DROP TABLE TEST;
> ok
......@@ -91,9 +91,7 @@ INSERT INTO TEST(T0) VALUES ('2000-01-01 23:59:59.999999999Z');
> update count: 1
SELECT T0 FROM TEST;
> T0
> ----------------------
> 2000-01-02 00:00:00+00
>> 2000-01-02 00:00:00+00
DROP TABLE TEST;
> ok
......@@ -41,10 +41,7 @@ INSERT INTO TEST VALUES (TIMESTAMP '1999-12-31 08:00:00');
> update count: 1
SELECT TIMESTAMP FROM TEST;
> TIMESTAMP
> -------------------
> 1999-12-31 08:00:00
> rows: 1
>> 1999-12-31 08:00:00
DROP TABLE TEST;
> ok
......@@ -84,9 +81,7 @@ INSERT INTO TEST(T0) VALUES ('2000-01-01 23:59:59.999999999');
> update count: 1
SELECT T0 FROM TEST;
> T0
> -------------------
> 2000-01-02 00:00:00
>> 2000-01-02 00:00:00
DROP TABLE TEST;
> ok
......@@ -15,11 +15,8 @@ select abs(-1) r1, abs(id) r1b from test;
> 1 1
> rows: 1
select abs(sum(id)) r1 from test;
> R1
> --
> 1
> rows: 1
select abs(sum(id)) from test;
>> 1
select abs(null) vn, abs(-1) r1, abs(1) r2, abs(0) r3, abs(-0.1) r4, abs(0.1) r5 from test;
> VN R1 R2 R3 R4 R5
......@@ -27,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
> 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
......@@ -4,14 +4,7 @@
--
call utf8tostring(decrypt('AES', '00000000000000000000000000000000', 'dbd42d55d4b923c4b03eba0396fac98e'));
> 'Hello World Test'
> ------------------
> Hello World Test
> rows: 1
>> Hello World Test
call utf8tostring(decrypt('AES', hash('sha256', stringtoutf8('Hello'), 1000), encrypt('AES', hash('sha256', stringtoutf8('Hello'), 1000), stringtoutf8('Hello World Test'))));
> 'Hello World Test'
> ------------------
> Hello World Test
> rows: 1
>> Hello World Test
......@@ -4,20 +4,10 @@
--
call encrypt('AES', '00000000000000000000000000000000', stringtoutf8('Hello World Test'));
> X'dbd42d55d4b923c4b03eba0396fac98e'
> -----------------------------------
> dbd42d55d4b923c4b03eba0396fac98e
> rows: 1
>> dbd42d55d4b923c4b03eba0396fac98e
CALL ENCRYPT('XTEA', '00', STRINGTOUTF8('Test'));
> X'8bc9a4601b3062692a72a5941072425f'
> -----------------------------------
> 8bc9a4601b3062692a72a5941072425f
> rows: 1
>> 8bc9a4601b3062692a72a5941072425f
call encrypt('XTEA', '000102030405060708090a0b0c0d0e0f', '4142434445464748');
> X'dea0b0b40966b0669fbae58ab503765f'
> -----------------------------------
> dea0b0b40966b0669fbae58ab503765f
> rows: 1
>> dea0b0b40966b0669fbae58ab503765f
......@@ -4,13 +4,7 @@
--
call hash('SHA256', stringtoutf8('Hello'), 1);
> X'185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969'
> -------------------------------------------------------------------
> 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
> rows: 1
>> 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
CALL HASH('SHA256', STRINGTOUTF8('Password'), 1000);
> X'c644a176ce920bde361ac336089b06cc2f1514dfa95ba5aabfe33f9a22d577f0'
> -------------------------------------------------------------------
> c644a176ce920bde361ac336089b06cc2f1514dfa95ba5aabfe33f9a22d577f0
> rows: 1
>> c644a176ce920bde361ac336089b06cc2f1514dfa95ba5aabfe33f9a22d577f0
......@@ -9,11 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select pi() pi from test;
> PI
> -----------------
> 3.141592653589793
> rows: 1
select pi() from test;
>> 3.141592653589793
......@@ -15,12 +15,5 @@ select rand(1) e, random() f from test;
> 0.7308781907032909 0.41008081149220166
> rows: 1
select rand() e from test;
> E
> -------------------
> 0.20771484130971707
> rows: 1
select rand() from test;
>> 0.20771484130971707
......@@ -21,8 +21,5 @@ select trunc(null, null) en, trunc(1.99, 0) e1, trunc(-10.9, 0) em10 from test;
> null 1.0 -10.0
> rows: 1
select trunc(1.3) R;
> R
> ---
> 1.0
> rows: 1
select trunc(1.3);
>> 1.0
......@@ -13,10 +13,5 @@ select concat(null, null) en, concat(null, 'a') ea, concat('b', null) eb, concat
> null a b abc
> rows: 1
SELECT CONCAT('a', 'b', 'c', 'd') AS test;
> TEST
> ----
> abcd
> rows: 1
SELECT CONCAT('a', 'b', 'c', 'd');
>> abcd
......@@ -2,3 +2,6 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
select lpad('string', 10, '+');
>> ++++string
......@@ -7,53 +7,29 @@ call regexp_replace('x', 'x', '\');
> exception
CALL REGEXP_REPLACE('abckaboooom', 'o+', 'o');
> 'abckabom'
> ----------
> abckabom
> rows: 1
>> abckabom
select regexp_replace('Sylvain', 'S..', 'TOTO', 'mni') as X;
> X
> --------
> TOTOvain
> rows: 1
select regexp_replace('Sylvain', 'S..', 'TOTO', 'mni');
>> TOTOvain
set mode oracle;
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1') as X from dual;
> X
> ----------
> last first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\\2 \1') as X from dual;
> X
> --------
> \2 first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\$2 \1') as X from dual;
> X
> --------
> $2 first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1') as X from dual;
> X
> -----
> $2 $1
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1');
>> last first
select regexp_replace('first last', '(\w+) (\w+)', '\\2 \1');
>> \2 first
select regexp_replace('first last', '(\w+) (\w+)', '\$2 \1');
>> $2 first
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1');
>> $2 $1
set mode regular;
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1') as X from dual;
> X
> ---
> 2 1
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1') as X from dual;
> X
> ----------
> last first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\2 \1');
>> 2 1
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1');
>> last first
......@@ -7,10 +7,7 @@ call select 1 from dual where regexp_like('x', 'x', '\');
> exception
select x from dual where REGEXP_LIKE('A', '[a-z]', 'i');
> X
> -
> 1
> rows: 1
>> 1
select x from dual where REGEXP_LIKE('A', '[a-z]', 'c');
> X
......
......@@ -2,3 +2,6 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
select rpad('string', 10, '+');
>> string++++
......@@ -10,15 +10,7 @@ INSERT INTO TEST VALUES(2, STRINGDECODE('abcsond\344rzeich\344 ') || char(22222)
> update count: 1
call STRINGENCODE(STRINGDECODE('abcsond\344rzeich\344 \u56ce \366\344\374\326\304\334\351\350\340\361!'));
> 'abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!'
> ------------------------------------------------------------------------------------------------
> abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!
> rows: 1
>> abcsond\u00e4rzeich\u00e4 \u56ce \u00f6\u00e4\u00fc\u00d6\u00c4\u00dc\u00e9\u00e8\u00e0\u00f1!
CALL STRINGENCODE(STRINGDECODE('Lines 1\nLine 2'));
> 'Lines 1\nLine 2'
> -----------------
> Lines 1\nLine 2
> rows: 1
>> Lines 1\nLine 2
......@@ -26,3 +26,9 @@ select substring(null from null) en, substring(null from null for null) e1, subs
> ---- ---- ---- --
> null null ob o
> rows: 1
select substr('[Hello]', 2, 5);
>> Hello
select substr('Hello World', -5);
>> World
......@@ -4,8 +4,4 @@
--
CALL UTF8TOSTRING(STRINGTOUTF8('This is a test'));
> 'This is a test'
> ----------------
> This is a test
> rows: 1
>> This is a test
......@@ -4,14 +4,7 @@
--
CALL XMLCDATA('<characters>');
> '<![CDATA[<characters>]]>'
> --------------------------
> <![CDATA[<characters>]]>
> rows: 1
>> <![CDATA[<characters>]]>
CALL XMLCDATA('special text ]]>');
> 'special text ]]&gt;'
> ---------------------
> special text ]]&gt;
> rows: 1
>> special text ]]&gt;
......@@ -4,14 +4,7 @@
--
CALL XMLCOMMENT('Test');
> STRINGDECODE('<!-- Test -->\n')
> -------------------------------
> <!-- Test -->
> rows: 1
>> <!-- Test -->
CALL XMLCOMMENT('--- test ---');
> STRINGDECODE('<!-- - - - test - - - -->\n')
> -------------------------------------------
> <!-- - - - test - - - -->
> rows: 1
>> <!-- - - - test - - - -->
......@@ -4,32 +4,16 @@
--
CALL XMLNODE('a', XMLATTR('href', 'http://h2database.com'));
> STRINGDECODE('<a href=\"http://h2database.com\"/>\n')
> -----------------------------------------------------
> <a href="http://h2database.com"/>
> rows: 1
>> <a href="http://h2database.com"/>
CALL XMLNODE('br');
> STRINGDECODE('<br/>\n')
> -----------------------
> <br/>
> rows: 1
>> <br/>
CALL XMLNODE('p', null, 'Hello World');
> STRINGDECODE('<p>Hello World</p>\n')
> ------------------------------------
> <p>Hello World</p>
> rows: 1
>> <p>Hello World</p>
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World') X;
> X
> ---------------------
> <p> Hello World </p>
> rows: 1
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World', false) X;
> X
> -------------------
> <p>Hello World</p>
> rows: 1
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World');
>> <p> Hello World </p>
SELECT XMLNODE('p', null, 'Hello' || chr(10) || 'World', false);
>> <p>Hello World</p>
......@@ -4,8 +4,4 @@
--
CALL XMLSTARTDOC();
> STRINGDECODE('<?xml version=\"1.0\"?>\n')
> -----------------------------------------
> <?xml version="1.0"?>
> rows: 1
>> <?xml version="1.0"?>
......@@ -4,26 +4,13 @@
--
CALL XMLTEXT('test');
> 'test'
> ------
> test
> rows: 1
>> test
CALL XMLTEXT('<test>');
> '&lt;test&gt;'
> --------------
> &lt;test&gt;
> rows: 1
>> &lt;test&gt;
SELECT XMLTEXT('hello' || chr(10) || 'world') X;
> X
> -----------
> hello world
> rows: 1
SELECT XMLTEXT('hello' || chr(10) || 'world');
>> hello world
CALL XMLTEXT('hello' || chr(10) || 'world', true);
> 'hello&#xa;world'
> -----------------
> hello&#xa;world
> rows: 1
>> hello&#xa;world
......@@ -2,3 +2,30 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
select array_contains((4.0, 2.0, 2.0), 2.0);
>> TRUE
select array_contains((4.0, 2.0, 2.0), 5.0);
>> FALSE
select array_contains(('one', 'two'), 'one');
>> TRUE
select array_contains(('one', 'two'), 'xxx');
>> FALSE
select array_contains(('one', 'two'), null);
>> FALSE
select array_contains((null, 'two'), null);
>> TRUE
select array_contains(null, 'one');
>> FALSE
select array_contains(((1, 2), (3, 4)), (1, 2));
>> TRUE
select array_contains(((1, 2), (3, 4)), (5, 6));
>> FALSE
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select autocommit() x_true from test;
> X_TRUE
> ------
> TRUE
> rows: 1
select autocommit() from test;
>> TRUE
......@@ -15,3 +15,87 @@ select cast(null as varchar(255)) xn, cast(' 10' as int) x10, cast(' 20 ' as int
> ---- --- ---
> null 10 20
> rows: 1
select cast(128 as binary);
>> 00000080
select cast(65535 as binary);
>> 0000ffff
select cast(cast('ff' as binary) as tinyint) x;
>> -1
select cast(cast('7f' as binary) as tinyint) x;
>> 127
select cast(cast('ff' as binary) as smallint) x;
>> 255
select cast(cast('ff' as binary) as int) x;
>> 255
select cast(cast('ffff' as binary) as long) x;
>> 65535
select cast(cast(65535 as long) as binary);
>> 000000000000ffff
select cast(cast(-1 as tinyint) as binary);
>> ff
select cast(cast(-1 as smallint) as binary);
>> ffff
select cast(cast(-1 as int) as binary);
>> ffffffff
select cast(cast(-1 as long) as binary);
>> ffffffffffffffff
select cast(cast(1 as tinyint) as binary);
>> 01
select cast(cast(1 as smallint) as binary);
>> 0001
select cast(cast(1 as int) as binary);
>> 00000001
select cast(cast(1 as long) as binary);
>> 0000000000000001
select cast(X'ff' as tinyint);
>> -1
select cast(X'ffff' as smallint);
>> -1
select cast(X'ffffffff' as int);
>> -1
select cast(X'ffffffffffffffff' as long);
>> -1
select cast(' 011 ' as int);
>> 11
select cast(cast(0.1 as real) as decimal);
>> 0.1
select cast(cast(95605327.73 as float) as decimal);
>> 95605327.73
select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary);
>> 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
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select right(database(), 6) x_script from test;
> X_SCRIPT
> --------
> SCRIPT
> rows: 1
select right(database(), 6) from test;
>> SCRIPT
......@@ -2,3 +2,30 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
select select decode(null, null, 'a');
>> a
select select decode(1, 1, 'a');
>> a
select select decode(1, 2, 'a');
>> null
select select decode(1, 1, 'a', 'else');
>> a
select select decode(1, 2, 'a', 'else');
>> else
select decode(4.0, 2.0, 2.0, 3.0, 3.0);
>> null
select decode('3', 2.0, 2.0, 3, 3.0);
>> 3.0
select decode(4.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 9.0);
>> 4.0
select decode(1, 1, '1', 1, '11') from dual;
>> 1
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select readonly() x_false from test;
> X_FALSE
> -------
> FALSE
> rows: 1
select readonly() from test;
>> FALSE
......@@ -2,3 +2,44 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- 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
......@@ -15,8 +15,5 @@ select user() x_sa, current_user() x_sa2 from test;
> SA SA
> rows: 1
select current_user() x_sa from test;
> X_SA
> ----
> SA
> rows: 1
select current_user() from test;
>> SA
......@@ -4,29 +4,17 @@
--
-- 01-Aug-03 + 3 months = 01-Nov-03
SELECT ADD_MONTHS('2003-08-01', 3) AS R;
> R
> -------------------
> 2003-11-01 00:00:00
> rows: 1
SELECT ADD_MONTHS('2003-08-01', 3);
>> 2003-11-01 00:00:00
-- 31-Jan-03 + 1 month = 28-Feb-2003
SELECT ADD_MONTHS('2003-01-31', 1) AS R;
> R
> -------------------
> 2003-02-28 00:00:00
> rows: 1
SELECT ADD_MONTHS('2003-01-31', 1);
>> 2003-02-28 00:00:00
-- 21-Aug-2003 - 3 months = 21-May-2003
SELECT ADD_MONTHS('2003-08-21', -3) AS R;
> R
> -------------------
> 2003-05-21 00:00:00
> rows: 1
SELECT ADD_MONTHS('2003-08-21', -3);
>> 2003-05-21 00:00:00
-- 21-Aug-2003 00:00:00.333 - 3 months = 21-May-2003 00:00:00.333
SELECT ADD_MONTHS('2003-08-21 00:00:00.333', -3) AS R;
> R
> -----------------------
> 2003-05-21 00:00:00.333
> rows: 1
SELECT ADD_MONTHS('2003-08-21 00:00:00.333', -3);
>> 2003-05-21 00:00:00.333
......@@ -16,7 +16,7 @@ select length(curtime())>=8 c1, length(current_time())>=8 c2, substring(curtime(
> 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
> ---- ---- ---- ----
> TRUE TRUE TRUE TRUE
......
......@@ -9,17 +9,11 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select dateadd('month', 1, timestamp '2003-01-31 10:20:30.012345678') d1 from test;
> D1
> -----------------------------
> 2003-02-28 10:20:30.012345678
> rows: 1
select dateadd('month', 1, timestamp '2003-01-31 10:20:30.012345678') from test;
>> 2003-02-28 10:20:30.012345678
select dateadd('year', -1, timestamp '2000-02-29 10:20:30.012345678') d1 from test;
> D1
> -----------------------------
> 1999-02-28 10:20:30.012345678
> rows: 1
select dateadd('year', -1, timestamp '2000-02-29 10:20:30.012345678') from test;
>> 1999-02-28 10:20:30.012345678
drop table test;
> ok
......@@ -30,47 +24,26 @@ create table test(d date, t time, ts timestamp);
insert into test values(date '2001-01-01', time '01:00:00', timestamp '2010-01-01 00:00:00');
> update count: 1
select ts + t x from test;
> X
> -------------------
> 2010-01-01 01:00:00
> rows: 1
select ts + t from test;
>> 2010-01-01 01:00:00
select ts + t + t - t x from test;
> X
> -------------------
> 2010-01-01 01:00:00
> rows: 1
>> 2010-01-01 01:00:00
select ts + t * 0.5 x from test;
> X
> -------------------
> 2010-01-01 00:30:00
> rows: 1
>> 2010-01-01 00:30:00
select ts + 0.5 x from test;
> X
> -------------------
> 2010-01-01 12:00:00
> rows: 1
>> 2010-01-01 12:00:00
select ts - 1.5 x from test;
> X
> -------------------
> 2009-12-30 12:00:00
> rows: 1
>> 2009-12-30 12:00:00
select ts + 0.5 * t + t - t x from test;
> X
> -------------------
> 2010-01-01 00:30:00
> rows: 1
>> 2010-01-01 00:30:00
select ts + t / 0.5 x from test;
> X
> -------------------
> 2010-01-01 02:00:00
> rows: 1
>> 2010-01-01 02:00:00
select d + t, t + d - t x from test;
> T + D X
......@@ -85,25 +58,16 @@ select 1 + d + 1, d - 1, 2 + ts + 2, ts - 2 from test;
> rows: 1
select 1 + d + t + 1 from test;
> DATEADD('DAY', 1, (T + DATEADD('DAY', 1, D)))
> ---------------------------------------------
> 2001-01-03 01:00:00
> rows: 1
>> 2001-01-03 01:00:00
select ts - t - 2 from test;
> DATEADD('DAY', -2, (TS - T))
> ----------------------------
> 2009-12-29 23:00:00
> rows: 1
>> 2009-12-29 23:00:00
drop table test;
> ok
call dateadd('MS', 1, TIMESTAMP '2001-02-03 04:05:06.789001');
> TIMESTAMP '2001-02-03 04:05:06.790001'
> --------------------------------------
> 2001-02-03 04:05:06.790001
> rows: 1
>> 2001-02-03 04:05:06.790001
SELECT DATEADD('MICROSECOND', 1, TIME '10:00:01'), DATEADD('MCS', 1, TIMESTAMP '2010-10-20 10:00:01.1');
> TIME '10:00:01.000001' TIMESTAMP '2010-10-20 10:00:01.100001'
......@@ -118,52 +82,29 @@ SELECT DATEADD('NANOSECOND', 1, TIME '10:00:01'), DATEADD('NS', 1, TIMESTAMP '20
> rows: 1
SELECT DATEADD('HOUR', 1, DATE '2010-01-20');
> TIMESTAMP '2010-01-20 01:00:00'
> -------------------------------
> 2010-01-20 01:00:00
> rows: 1
>> 2010-01-20 01:00:00
SELECT DATEADD('MINUTE', 30, TIME '12:30:55');
> TIME '13:00:55'
> ---------------
> 13:00:55
> rows: 1
>> 13:00:55
SELECT DATEADD('DAY', 1, TIME '12:30:55');
> exception
SELECT DATEADD('QUARTER', 1, DATE '2010-11-16');
> DATE '2011-02-16'
> -----------------
> 2011-02-16
> rows: 1
>> 2011-02-16
SELECT DATEADD('DAY', 10, TIMESTAMP WITH TIME ZONE '2000-01-05 15:00:30.123456789-10');
> TIMESTAMP WITH TIME ZONE '2000-01-15 15:00:30.123456789-10'
> -----------------------------------------------------------
> 2000-01-15 15:00:30.123456789-10
> rows: 1
>> 2000-01-15 15:00:30.123456789-10
SELECT TIMESTAMPADD('DAY', 10, TIMESTAMP '2000-01-05 15:00:30.123456789');
> TIMESTAMP '2000-01-15 15:00:30.123456789'
> -----------------------------------------
> 2000-01-15 15:00:30.123456789
> rows: 1
>> 2000-01-15 15:00:30.123456789
SELECT TIMESTAMPADD('TIMEZONE_HOUR', 1, TIMESTAMP WITH TIME ZONE '2010-01-01 10:00:00+07:30') AS T;
> T
> -------------------------
> 2010-01-01 10:00:00+08:30
> rows: 1
SELECT TIMESTAMPADD('TIMEZONE_HOUR', 1, TIMESTAMP WITH TIME ZONE '2010-01-01 10:00:00+07:30');
>> 2010-01-01 10:00:00+08:30
SELECT TIMESTAMPADD('TIMEZONE_MINUTE', -45, TIMESTAMP WITH TIME ZONE '2010-01-01 10:00:00+07:30') AS T;
> T
> -------------------------
> 2010-01-01 10:00:00+06:45
> rows: 1
SELECT TIMESTAMPADD('TIMEZONE_MINUTE', -45, TIMESTAMP WITH TIME ZONE '2010-01-01 10:00:00+07:30');
>> 2010-01-01 10:00:00+06:45
SELECT DATEADD(HOUR, 1, TIME '23:00:00') AS T;
> T
> --------
> 00:00:00
SELECT DATEADD(HOUR, 1, TIME '23:00:00');
>> 00:00:00
> rows: 1
......@@ -9,89 +9,47 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select datediff('yy', timestamp '2003-12-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d1 from test;
> D1
> --
> 1
> rows: 1
select datediff('yy', timestamp '2003-12-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') from test;
>> 1
select datediff('year', timestamp '2003-12-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d1 from test;
> D1
> --
> 1
> rows: 1
select datediff('year', timestamp '2003-12-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') from test;
>> 1
select datediff('mm', timestamp '2003-11-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d2 from test;
> D2
> --
> 2
> rows: 1
select datediff('mm', timestamp '2003-11-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') from test;
>> 2
select datediff('month', timestamp '2003-11-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d2 from test;
> D2
> --
> 2
> rows: 1
select datediff('month', timestamp '2003-11-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') from test;
>> 2
select datediff('dd', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-05 10:00:00.0') d4 from test;
> D4
> --
> 4
> rows: 1
select datediff('dd', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-05 10:00:00.0') from test;
>> 4
select datediff('day', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-05 10:00:00.0') d4 from test;
> D4
> --
> 4
> rows: 1
select datediff('day', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-05 10:00:00.0') from test;
>> 4
select datediff('hh', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-02 10:00:00.0') d24 from test;
> D24
> ---
> 24
> rows: 1
select datediff('hh', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-02 10:00:00.0') from test;
>> 24
select datediff('hour', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-02 10:00:00.0') d24 from test;
> D24
> ---
> 24
> rows: 1
select datediff('hour', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-02 10:00:00.0') from test;
>> 24
select datediff('mi', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d20 from test;
> D20
> ---
> -20
> rows: 1
select datediff('mi', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') from test;
>> -20
select datediff('minute', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d20 from test;
> D20
> ---
> -20
> rows: 1
select datediff('minute', timestamp '2004-01-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') from test;
>> -20
select datediff('ss', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') d1 from test;
> D1
> --
> 1
> rows: 1
select datediff('ss', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') from test;
>> 1
select datediff('second', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') d1 from test;
> D1
> --
> 1
> rows: 1
select datediff('second', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') from test;
>> 1
select datediff('ms', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') d50x from test;
> D50X
> ----
> 500
> rows: 1
select datediff('ms', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') from test;
>> 500
select datediff('millisecond', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') d50x from test;
> D50X
> ----
> 500
> rows: 1
select datediff('millisecond', timestamp '2004-01-01 10:00:00.5', timestamp '2004-01-01 10:00:01.0') from test;
>> 500
SELECT DATEDIFF('SECOND', '1900-01-01 00:00:00.001', '1900-01-01 00:00:00.002'), DATEDIFF('SECOND', '2000-01-01 00:00:00.001', '2000-01-01 00:00:00.002');
> 0 0
......@@ -154,10 +112,7 @@ call datediff('MS', TIMESTAMP '2001-02-03 04:05:06.789001', TIMESTAMP '2001-02-0
> rows: 1
call datediff('MS', TIMESTAMP '1900-01-01 00:00:01.000', TIMESTAMP '2008-01-01 00:00:00.000');
> 3408134399000
> -------------
> 3408134399000
> rows: 1
>> 3408134399000
SELECT DATEDIFF('MICROSECOND', '2006-01-01 00:00:00.0000000', '2006-01-01 00:00:00.123456789'),
DATEDIFF('MCS', '2006-01-01 00:00:00.0000000', '2006-01-01 00:00:00.123456789'),
......@@ -212,46 +167,48 @@ SELECT DATEDIFF('WEEK', DATE '1969-12-28', DATE '1969-12-29'), DATEDIFF('ISO_WEE
> rows: 1
SELECT DATEDIFF('QUARTER', DATE '2009-12-30', DATE '2009-12-31');
> 0
> -
> 0
> rows: 1
>> 0
SELECT DATEDIFF('QUARTER', DATE '2010-01-01', DATE '2009-12-31');
> -1
> --
> -1
> rows: 1
>> -1
SELECT DATEDIFF('QUARTER', DATE '2010-01-01', DATE '2010-01-02');
> 0
> -
> 0
> rows: 1
>> 0
SELECT DATEDIFF('QUARTER', DATE '2010-01-01', DATE '2010-03-31');
> 0
> -
> 0
> rows: 1
>> 0
SELECT DATEDIFF('QUARTER', DATE '-1000-01-01', DATE '2000-01-01');
> 12000
> -----
> 12000
> rows: 1
>> 12000
SELECT DATEDIFF('TIMEZONE_HOUR', TIMESTAMP WITH TIME ZONE '2010-01-01 10:00:00+01',
TIMESTAMP WITH TIME ZONE '2012-02-02 12:00:00+02');
> 1
> -
> 1
> rows: 1
>> 1
SELECT DATEDIFF('TIMEZONE_MINUTE', TIMESTAMP WITH TIME ZONE '2010-01-01 10:00:00+01:15',
TIMESTAMP WITH TIME ZONE '2012-02-02 12:00:00+02');
> 45
> --
> 45
> rows: 1
>> 45
select datediff('HOUR', timestamp '2007-01-06 10:00:00Z', '2007-01-06 10:00:00Z');
>> 0
select datediff('HOUR', timestamp '1234-05-06 10:00:00+01:00', '1234-05-06 10:00:00+02:00');
>> -1
select datediff('HOUR', timestamp '1234-05-06 10:00:00+01:00', '1234-05-06 10:00:00-02:00');
>> 3
select timestampdiff(month, '2003-02-01','2003-05-01');
>> 3
select timestampdiff(YEAR,'2002-05-01','2001-01-01');
>> -1
select timestampdiff(YEAR,'2017-01-01','2016-12-31 23:59:59');
>> -1
select timestampdiff(YEAR,'2017-01-01','2017-12-31 23:59:59');
>> 0
select timestampdiff(MINUTE,'2003-02-01','2003-05-01 12:05:55');
>> 128885
......@@ -9,11 +9,8 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select dayofmonth(date '2005-09-12') d12 from test;
> D12
> ---
> 12
> rows: 1
select dayofmonth(date '2005-09-12') from test;
>> 12
drop table test;
> ok
......
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select dayofweek(date '2005-09-12') d2 from test;
> D2
> --
> 2
> rows: 1
select dayofweek(date '2005-09-12') from test;
>> 2
......@@ -10,7 +10,4 @@ insert into test values(1, 'Hello');
> update count: 1
select dayofyear(date '2005-01-01') d1 from test;
> D1
> --
> 1
> rows: 1
>> 1
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select dayname(date '2005-09-12') d_monday from test;
> D_MONDAY
> --------
> Monday
> rows: 1
select dayname(date '2005-09-12') from test;
>> Monday
......@@ -18,64 +18,61 @@ SELECT EXTRACT (NANOSECOND FROM TIME '10:00:00.123456789'),
> rows: 1
select EXTRACT (EPOCH from time '00:00:00');
> 0
>> 0
select EXTRACT (EPOCH from time '10:00:00');
> 36000
>> 36000
select EXTRACT (EPOCH from time '10:00:00.123456');
> 36000.123456
>> 36000.123456
select EXTRACT (EPOCH from date '1970-01-01');
> 0
>> 0
select EXTRACT (EPOCH from date '2000-01-03');
> 946857600
>> 946857600
select EXTRACT (EPOCH from timestamp '1970-01-01 00:00:00');
> 0
>> 0
select EXTRACT (EPOCH from timestamp '1970-01-03 12:00:00.123456');
> 216000.123456
>> 216000.123456
select EXTRACT (EPOCH from timestamp '2000-01-03 12:00:00.123456');
> 946900800.123456
>> 946900800.123456
select EXTRACT (EPOCH from timestamp '2500-01-03 12:00:00.654321');
> 16725441600.654321
>> 16725441600.654321
select EXTRACT (EPOCH from timestamp with time zone '1970-01-01 00:00:00+05');
> -18000
>> -18000
select EXTRACT (EPOCH from timestamp with time zone '1970-01-03 12:00:00.123456+05');
> 198000.123456
>> 198000.123456
select EXTRACT (EPOCH from timestamp with time zone '2000-01-03 12:00:00.123456+05');
> 946882800.123456
>> 946882800.123456
select extract(EPOCH from '2001-02-03 14:15:16');
> 981209716
>> 981209716
SELECT EXTRACT(TIMEZONE_HOUR FROM TIMESTAMP WITH TIME ZONE '2010-01-02 5:00:00+07:15');
> 7
> -
> 7
> rows: 1
>> 7
SELECT EXTRACT(TIMEZONE_HOUR FROM TIMESTAMP WITH TIME ZONE '2010-01-02 5:00:00-08:30');
> -8
> --
> -8
> rows: 1
>> -8
SELECT EXTRACT(TIMEZONE_MINUTE FROM TIMESTAMP WITH TIME ZONE '2010-01-02 5:00:00+07:15');
> 15
> --
> 15
> rows: 1
>> 15
SELECT EXTRACT(TIMEZONE_MINUTE FROM TIMESTAMP WITH TIME ZONE '2010-01-02 5:00:00-08:30');
> -30
> ---
> -30
> rows: 1
>> -30
select extract(hour from timestamp '2001-02-03 14:15:16');
>> 14
select extract(hour from '2001-02-03 14:15:16');
>> 14
select extract(week from timestamp '2001-02-03 14:15:16');
>> 5
......@@ -4,43 +4,22 @@
--
CALL FORMATDATETIME(PARSEDATETIME('2001-02-03 04:05:06 GMT', 'yyyy-MM-dd HH:mm:ss z', 'en', 'GMT'), 'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT');
> 'Sat, 3 Feb 2001 04:05:06 GMT'
> ------------------------------
> Sat, 3 Feb 2001 04:05:06 GMT
> rows: 1
>> Sat, 3 Feb 2001 04:05:06 GMT
CALL FORMATDATETIME(TIMESTAMP '2001-02-03 04:05:06', 'yyyy-MM-dd HH:mm:ss');
> '2001-02-03 04:05:06'
> ---------------------
> 2001-02-03 04:05:06
> rows: 1
>> 2001-02-03 04:05:06
CALL FORMATDATETIME(TIMESTAMP '2001-02-03 04:05:06', 'MM/dd/yyyy HH:mm:ss');
> '02/03/2001 04:05:06'
> ---------------------
> 02/03/2001 04:05:06
> rows: 1
>> 02/03/2001 04:05:06
CALL FORMATDATETIME(TIMESTAMP '2001-02-03 04:05:06', 'd. MMMM yyyy', 'de');
> '3. Februar 2001'
> -----------------
> 3. Februar 2001
> rows: 1
>> 3. Februar 2001
CALL FORMATDATETIME(PARSEDATETIME('Sat, 3 Feb 2001 04:05:06 GMT', 'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT'), 'yyyy-MM-dd HH:mm:ss', 'en', 'GMT');
> '2001-02-03 04:05:06'
> ---------------------
> 2001-02-03 04:05:06
> rows: 1
>> 2001-02-03 04:05:06
SELECT FORMATDATETIME(TIMESTAMP WITH TIME ZONE '2010-05-06 07:08:09.123Z', 'yyyy-MM-dd HH:mm:ss.SSS z') AS S;
> S
> ---------------------------
> 2010-05-06 07:08:09.123 UTC
> rows: 1
SELECT FORMATDATETIME(TIMESTAMP WITH TIME ZONE '2010-05-06 07:08:09.123Z', 'yyyy-MM-dd HH:mm:ss.SSS z');
>> 2010-05-06 07:08:09.123 UTC
SELECT FORMATDATETIME(TIMESTAMP WITH TIME ZONE '2010-05-06 07:08:09.123+13:30', 'yyyy-MM-dd HH:mm:ss.SSS z') AS S;
> S
> ---------------------------------
> 2010-05-06 07:08:09.123 GMT+13:30
> rows: 1
SELECT FORMATDATETIME(TIMESTAMP WITH TIME ZONE '2010-05-06 07:08:09.123+13:30', 'yyyy-MM-dd HH:mm:ss.SSS z');
>> 2010-05-06 07:08:09.123 GMT+13:30
......@@ -9,11 +9,8 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select hour(time '23:10:59') d23 from test;
> D23
> ---
> 23
> rows: 1
select hour(time '23:10:59') from test;
>> 23
drop table test;
> ok
......@@ -33,3 +30,6 @@ select hour(ts) h from test;
drop table test;
> ok
select hour('2001-02-03 14:15:16');
>> 14
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select minute(timestamp '2005-01-01 23:10:59') d10 from test;
> D10
> ---
> 10
> rows: 1
select minute(timestamp '2005-01-01 23:10:59') from test;
>> 10
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select month(date '2005-09-25') d9 from test;
> D9
> --
> 9
> rows: 1
select month(date '2005-09-25') from test;
>> 9
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select monthname(date '2005-09-12') d_sept from test;
> D_SEPT
> ---------
> September
> rows: 1
select monthname(date '2005-09-12') from test;
>> September
......@@ -4,14 +4,7 @@
--
CALL PARSEDATETIME('3. Februar 2001', 'd. MMMM yyyy', 'de');
> TIMESTAMP '2001-02-03 00:00:00'
> -------------------------------
> 2001-02-03 00:00:00
> rows: 1
>> 2001-02-03 00:00:00
CALL PARSEDATETIME('02/03/2001 04:05:06', 'MM/dd/yyyy HH:mm:ss');
> TIMESTAMP '2001-02-03 04:05:06'
> -------------------------------
> 2001-02-03 04:05:06
> rows: 1
>> 2001-02-03 04:05:06
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select quarter(date '2005-09-01') d3 from test;
> D3
> --
> 3
> rows: 1
select quarter(date '2005-09-01') from test;
>> 3
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select second(timestamp '2005-01-01 23:10:59') d59 from test;
> D59
> ---
> 59
> rows: 1
select second(timestamp '2005-01-01 23:10:59') from test;
>> 59
......@@ -3,26 +3,14 @@
-- Initial Developer: H2 Group
--
select trunc('2015-05-29 15:00:00') R;
> R
> -------------------
> 2015-05-29 00:00:00
> rows: 1
select trunc('2015-05-29 15:00:00');
>> 2015-05-29 00:00:00
select trunc('2015-05-29') R;
> R
> -------------------
> 2015-05-29 00:00:00
> rows: 1
select trunc('2015-05-29');
>> 2015-05-29 00:00:00
select trunc(timestamp '2000-01-01 10:20:30.0') R;
> R
> -------------------
> 2000-01-01 00:00:00
> rows: 1
select trunc(timestamp '2000-01-01 10:20:30.0');
>> 2000-01-01 00:00:00
select trunc(timestamp '2001-01-01 14:00:00.0') R;
> R
> -------------------
> 2001-01-01 00:00:00
> rows: 1
select trunc(timestamp '2001-01-01 14:00:00.0');
>> 2001-01-01 00:00:00
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select week(date '2003-01-09') d1 from test;
> D1
> --
> 2
> rows: 1
select week(date '2003-01-09') from test;
>> 2
......@@ -9,8 +9,5 @@ create memory table test(id int primary key, name varchar(255));
insert into test values(1, 'Hello');
> update count: 1
select year(date '2005-01-01') d2005 from test;
> D2005
> -----
> 2005
> rows: 1
select year(date '2005-01-01') from test;
>> 2005
......@@ -15,18 +15,6 @@ select * from test where id in (select id from test order by 'x');
drop table test;
> 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;
> X I
> - -----
......@@ -144,12 +132,6 @@ select case seq.nextval when 2 then 'two' when 3 then 'three' when 1 then 'one'
drop sequence seq;
> ok
select decode(1, 1, '1', 1, '11') r from dual;
> R
> -
> 1
> rows: 1
create table test(x int);
> ok
......@@ -236,9 +218,6 @@ update test set pid = 1 where id = 2;
drop table test;
> ok
call cast('null' as uuid);
> exception
create table test(name varchar(255));
> ok
......@@ -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 */
> rows: 1
select -cast(0 as double) nz;
> NZ
> ---
> 0.0
> rows: 1
select () empty;
> EMPTY
> -----
......@@ -1400,28 +1373,6 @@ DROP ROLE Y;
DROP ROLE X;
> 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;
> exception
......@@ -2064,12 +2015,6 @@ select * from V, C where V.V = C.C;
drop table A, B, C, V cascade;
> 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);
> ok
......@@ -2275,13 +2220,6 @@ select (1, 2);
> (1, 2)
> 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);
> ok
......@@ -2790,18 +2728,6 @@ drop view address_view;
drop table address;
> 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)";
> ok
......
......@@ -14,46 +14,8 @@ select 1.0000000 / 3 * 0.00000;
> 0.0000000000000000000000000000000000000;
select 1.0000000 / 3 * 0.000000;
> 0E-38;
select substr('[Hello]', 2, 5);
> Hello;
select substr('Hello World', -5);
> World;
create table test(id null);
drop table test;
select select decode(null, null, 'a');
> a;
select select decode(1, 1, 'a');
> a;
select select decode(1, 2, 'a');
> null;
select select decode(1, 1, 'a', 'else');
> a;
select select decode(1, 2, 'a', 'else');
> else;
select decode(4.0, 2.0, 2.0, 3.0, 3.0);
> null;
select decode('3', 2.0, 2.0, 3, 3.0);
> 3.0;
select decode(4.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 9.0);
> 4.0;
select array_contains((4.0, 2.0, 2.0), 2.0);
> TRUE;
select array_contains((4.0, 2.0, 2.0), 5.0);
> FALSE;
select array_contains(('one', 'two'), 'one');
> TRUE;
select array_contains(('one', 'two'), 'xxx');
> FALSE;
select array_contains(('one', 'two'), null);
> FALSE;
select array_contains((null, 'two'), null);
> TRUE;
select array_contains(null, 'one');
> FALSE;
select array_contains(((1, 2), (3, 4)), (1, 2));
> TRUE;
select array_contains(((1, 2), (3, 4)), (5, 6));
> FALSE;
select * from (select group_concat(distinct 1) from system_range(1, 3));
> 1;
select sum(mod(x, 2) = 1) from system_range(1, 10);
......@@ -69,50 +31,8 @@ select {fn TIMESTAMPADD(SQL_TSI_DAY, 1, {ts '2011-10-20 20:30:40.001'})};
> 2011-10-21 20:30:40.001;
select {fn TIMESTAMPADD(SQL_TSI_SECOND, 1, cast('2011-10-20 20:30:40.001' as timestamp))};
> 2011-10-20 20:30:41.001;
select cast(128 as binary);
> 00000080;
select cast(65535 as binary);
> 0000ffff;
select cast(cast('ff' as binary) as tinyint) x;
> -1;
select cast(cast('7f' as binary) as tinyint) x;
> 127;
select cast(cast('ff' as binary) as smallint) x;
> 255;
select cast(cast('ff' as binary) as int) x;
> 255;
select cast(cast('ffff' as binary) as long) x;
> 65535;
select cast(cast(65535 as long) as binary);
> 000000000000ffff;
select cast(cast(-1 as tinyint) as binary);
> ff;
select cast(cast(-1 as smallint) as binary);
> ffff;
select cast(cast(-1 as int) as binary);
> ffffffff;
select cast(cast(-1 as long) as binary);
> ffffffffffffffff;
select cast(cast(1 as tinyint) as binary);
> 01;
select cast(cast(1 as smallint) as binary);
> 0001;
select cast(cast(1 as int) as binary);
> 00000001;
select cast(cast(1 as long) as binary);
> 0000000000000001;
select cast(X'ff' as tinyint);
> -1;
select cast(X'ffff' as smallint);
> -1;
select cast(X'ffffffff' as int);
> -1;
select cast(X'ffffffffffffffff' as long);
> -1;
select N'test';
> test;
select cast(' 011 ' as int);
> 11;
select E'test\\test';
> test\test;
create table a(id int) as select null;
......@@ -156,24 +76,8 @@ alter table test alter column id drop not null;
select is_nullable from information_schema.columns c where c.table_name = 'TEST' and c.column_name = 'ID';
> YES;
drop table test;
select cast(cast(0.1 as real) as decimal);
> 0.1;
select cast(cast(95605327.73 as float) as decimal);
> 95605327.73;
select timestampdiff(month, '2003-02-01','2003-05-01');
> 3;
select timestampdiff(YEAR,'2002-05-01','2001-01-01');
> -1;
select timestampdiff(YEAR,'2017-01-01','2016-12-31 23:59:59');
> -1;
select timestampdiff(YEAR,'2017-01-01','2017-12-31 23:59:59');
> 0;
select timestampdiff(MINUTE,'2003-02-01','2003-05-01 12:05:55');
> 128885;
select x from (select *, rownum as r from system_range(1, 3)) where r=2;
> 2;
select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary);
> 0102030405060708090a0b0c0d0e0f00;
create table test(name varchar(255)) as select 'Hello+World+';
select count(*) from test where name like 'Hello++World++' escape '+';
> 1;
......@@ -356,15 +260,6 @@ CREATE TABLE Contact.Contact (id BIGINT primary key, FOREIGN KEY (id) REFERENCES
drop schema contact cascade;
drop table account, person;
select extract(hour from timestamp '2001-02-03 14:15:16');
> 14;
select extract(hour from '2001-02-03 14:15:16');
> 14;
select hour('2001-02-03 14:15:16');
> 14;
select extract(week from timestamp '2001-02-03 14:15:16');
> 5;
CREATE TABLE TEST(A int NOT NULL, B int NOT NULL, C int) ;
ALTER TABLE TEST ADD CONSTRAINT CON UNIQUE(A,B);
ALTER TABLE TEST DROP C;
......@@ -385,10 +280,6 @@ select count(*) from (select * from (select * from test union select * from test
select 1 from ((test d1 inner join test d2 on d1.id = d2.id) inner join test d3 on d1.id = d3.id) inner join test d4 on d4.id = d1.id;
drop table test;
select lpad('string', 10, '+');
> ++++string;
select rpad('string', 10, '+');
> string++++;
select lpad('string', 10);
> string;
......@@ -561,12 +452,6 @@ select date '+0011-01-01';
> 0011-01-01;
select date'-0010-01-01';
> -10-01-01;
select datediff('HOUR', timestamp '2007-01-06 10:00:00Z', '2007-01-06 10:00:00Z');
> 0;
select datediff('HOUR', timestamp '1234-05-06 10:00:00+01:00', '1234-05-06 10:00:00+02:00');
> -1;
select datediff('HOUR', timestamp '1234-05-06 10:00:00+01:00', '1234-05-06 10:00:00-02:00');
> 3;
create schema TEST_SCHEMA;
create table TEST_SCHEMA.test(id int);
......
......@@ -70,30 +70,26 @@ public class GenerateDoc {
// String help = "SELECT * FROM INFORMATION_SCHEMA.HELP WHERE SECTION";
String help = "SELECT ROWNUM ID, * FROM CSVREAD('" +
IN_HELP + "', NULL, 'lineComment=#') WHERE SECTION ";
map("commands",
help + "LIKE 'Commands%' ORDER BY ID", true);
map("commandsDML",
help + "= 'Commands (DML)' ORDER BY ID", false);
help + "= 'Commands (DML)' ORDER BY ID", true);
map("commandsDDL",
help + "= 'Commands (DDL)' ORDER BY ID", false);
help + "= 'Commands (DDL)' ORDER BY ID", true);
map("commandsOther",
help + "= 'Commands (Other)' ORDER BY ID", false);
help + "= 'Commands (Other)' ORDER BY ID", true);
map("datetimeFields",
help + "= 'Datetime fields' ORDER BY ID", true);
map("otherGrammar",
help + "= 'Other Grammar' ORDER BY ID", true);
map("functionsAggregate",
help + "= 'Functions (Aggregate)' ORDER BY ID", false);
help + "= 'Functions (Aggregate)' ORDER BY ID", true);
map("functionsNumeric",
help + "= 'Functions (Numeric)' ORDER BY ID", false);
help + "= 'Functions (Numeric)' ORDER BY ID", true);
map("functionsString",
help + "= 'Functions (String)' ORDER BY ID", false);
help + "= 'Functions (String)' ORDER BY ID", true);
map("functionsTimeDate",
help + "= 'Functions (Time and Date)' ORDER BY ID", false);
help + "= 'Functions (Time and Date)' ORDER BY ID", true);
map("functionsSystem",
help + "= 'Functions (System)' ORDER BY ID", false);
map("functionsAll",
help + "LIKE 'Functions%' ORDER BY SECTION, ID", true);
help + "= 'Functions (System)' ORDER BY ID", true);
map("dataTypes",
help + "LIKE 'Data Types%' ORDER BY SECTION, ID", true);
map("informationSchema", "SELECT TABLE_NAME TOPIC, " +
......
......@@ -27,7 +27,13 @@ public class LinkChecker {
private static final boolean TEST_EXTERNAL_LINKS = false;
private static final boolean OPEN_EXTERNAL_LINKS = false;
private static final String[] IGNORE_MISSING_LINKS_TO = {
"SysProperties", "ErrorCode"
"SysProperties", "ErrorCode",
// TODO check these replacement link too
"#build_index",
"#datatypes_index",
"#faq_index",
"#grammar_index",
"#tutorial_index"
};
private final HashMap<String, String> targets = new HashMap<>();
......
......@@ -32,7 +32,8 @@ public class MergeDocs {
String[] pages = { "quickstart.html", "installation.html",
"tutorial.html", "features.html", "performance.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();
for (String fileName : pages) {
String text = getContent(fileName);
......@@ -41,6 +42,7 @@ public class MergeDocs {
}
text = disableRailroads(text);
text = removeHeaderFooter(fileName, text);
text = fixLinks(text);
buff.append(text);
}
String finalText = buff.toString();
......@@ -51,7 +53,7 @@ public class MergeDocs {
writer.println("H2 Documentation");
writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" " +
"href=\"stylesheetPdf.css\" /></head><body>");
writer.println("<h1>H2 Database Engine</h1>");
writer.println("<p class=\"title\">H2 Database Engine</p>");
writer.println("<p>Version " + Constants.getFullVersion() + "</p>");
writer.println(finalText);
writer.println("</body></html>");
......@@ -92,6 +94,15 @@ public class MergeDocs {
return text;
}
private static String fixLinks(String text) {
return text
.replaceAll("href=\"build.html\"", "href=\"#build_index\"")
.replaceAll("href=\"datatypes.html\"", "href=\"#datatypes_index\"")
.replaceAll("href=\"faq.html\"", "href=\"#faq_index\"")
.replaceAll("href=\"grammar.html\"", "href=\"#grammar_index\"")
.replaceAll("href=\"tutorial.html\"", "href=\"#tutorial_index\"");
}
private static String getContent(String fileName) throws Exception {
File file = new File(BASE_DIR, fileName);
int length = (int) file.length();
......
......@@ -766,4 +766,4 @@ interpolated thead
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
openoffice organize libre
openoffice organize libre systemtables gmane sea
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论