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

--no commit message

--no commit message
上级 2e73e772
......@@ -39,6 +39,13 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3>
<h3>Version 1.0.60 (2007-10-?)</h3><ul>
<li>PreparedStatement.setMaxRows could not be changed to a higher value after the statement was executed.
</li><li>The H2 Console could not connect twice to the same H2 embedded database at the same time. Fixed.
</li><li>CSVREAD, RUNSCRIPT and so on now support URLs as well, using
URL.openStream(). Example: select * from csvread('jar:file:///c:/temp/test.jar!/test.csv');
</li></ul>
<h3>Version 1.0.59 (2007-10-03)</h3><ul>
<li>When the data type was unknown in a subquery, sometimes the wrong exception (ArrayIndexOutOfBounds) was thrown. Fixed.
</li><li>If the process was killed while the database was running, sometimes the database could not be opened
......@@ -494,23 +501,23 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Better support large transactions, large updates / deletes: use less memory
</li><li>Better support large transactions, large updates / deletes: allow tables without primary key
</li><li>Support Oracle RPAD and LPAD(string, n[, pad]) (truncate the end if longer)
</li><li>Allow editing NULL values in the Console
</li><li>Updatable result sets: DatabaseMetaData.ownUpdatesAreVisible = true (for insert, delete, update)
Simple solution: automatically calls 'refresh' when the result was changed.
Compare with other databases.
</li><li>User defined aggregate functions
</li><li>Procedural language / script language (Javascript)
</li></ul>
<h3>Priority 2</h3>
<ul>
<li>Support OSGi: http://oscar-osgi.sourceforge.net, http://incubator.apache.org/felix/index.html
</li><li>Procedural language / script language (Javascript)
<li>Updatable result sets: DatabaseMetaData.ownUpdatesAreVisible = true (for insert, delete, update)
Simple solution: automatically calls 'refresh' when the result was changed.
Compare with other databases.
</li><li>Allow editing NULL values in the Console
</li><li>Support OSGi: http://oscar-osgi.sourceforge.net, http://incubator.apache.org/felix/index.html
</li><li>Change LOB mechanism (less files, keep index of lob files, point to files and row, delete unused files earlier, maybe bundle files into a tar file)
</li><li>Set the database in an 'exclusive' mode (restrict to one user at a time)
</li><li>Clustering: recovery needs to becomes fully automatic. Global write lock feature.
</li><li>Deferred integrity checking (DEFERRABLE INITIALLY DEFERRED)
</li><li>Groovy Stored Procedures (http://groovy.codehaus.org/Groovy+SQL)
</li><li>System table / function: cache usage
</li><li>User defined aggregate functions
</li><li>Add a migration guide (list differences between databases)
</li><li>Optimization: automatic index creation suggestion using the trace file?
</li><li>Compression performance: don't allocate buffers, compress / expand in to out buffer
......
......@@ -31,17 +31,17 @@ Welcome to H2, the free SQL database. The main feature of H2 are:
<table style="border: 0px; margin: 5px; background-color: #eee;">
<tr><td style="border: 0px; background-color: #eee;" colspan="2">
<h3>Download</h3>
Version 1.0.58 (2007-09-15):
Version 1.0.59 (2007-10-03):
</td></tr>
<tr><td style="border: 0px; background-color: #eee;">
<a href="http://www.h2database.com/h2-setup-2007-09-15.exe"><img border="1" src="images/download.png" alt="download" /></a>
<a href="http://www.h2database.com/h2-setup-2007-10-03.exe"><img border="1" src="images/download.png" alt="download" /></a>
</td><td style="vertical-align: middle; border: 0px; background-color: #eee;">
<a href="http://www.h2database.com/h2-setup-2007-09-15.exe">Windows Installer (2.7 MB)</a>
<a href="http://www.h2database.com/h2-setup-2007-10-03.exe">Windows Installer (2.7 MB)</a>
</td></tr>
<tr><td style="border: 0px; background-color: #eee;">
<a href="http://www.h2database.com/h2-2007-09-15.zip"><img border="1" src="images/download.png" alt="download" /></a>
<a href="http://www.h2database.com/h2-2007-10-03.zip"><img border="1" src="images/download.png" alt="download" /></a>
</td><td style="vertical-align: middle; border: 0px; background-color: #eee;">
<a href="http://www.h2database.com/h2-2007-09-15.zip">All platforms (zip, 3.8 MB)</a>
<a href="http://www.h2database.com/h2-2007-10-03.zip">All platforms (zip, 3.8 MB)</a>
</td></tr>
<tr><td style="border: 0px; background-color: #eee;" colspan="2">
<a href="download.html">All Downloads</a>
......
......@@ -3692,6 +3692,10 @@ public class Parser {
readIfEqualOrTo();
read();
return new NoOperation(session);
} else if (readIf("DATABASE_EVENT_LISTENER_OBJECT")) {
readIfEqualOrTo();
read();
return new NoOperation(session);
} else if (readIf("RECOVER")) {
readIfEqualOrTo();
read();
......
......@@ -15,7 +15,6 @@ import org.h2.expression.ConditionAndOr;
import org.h2.expression.Expression;
import org.h2.expression.ExpressionColumn;
import org.h2.expression.ExpressionVisitor;
import org.h2.expression.ValueExpression;
import org.h2.expression.Wildcard;
import org.h2.index.Index;
import org.h2.message.Message;
......@@ -30,7 +29,6 @@ import org.h2.util.StringUtils;
import org.h2.util.ValueHashMap;
import org.h2.value.Value;
import org.h2.value.ValueArray;
import org.h2.value.ValueInt;
import org.h2.value.ValueNull;
/**
......@@ -259,15 +257,9 @@ public class Select extends Query {
return null;
}
private void queryFlat(int columnCount, LocalResult result) throws SQLException {
int limitRows;
if (limit == null) {
limitRows = 0;
} else {
limitRows = limit.getValue(session).getInt();
if (offset != null) {
limitRows += offset.getValue(session).getInt();
}
private void queryFlat(int columnCount, LocalResult result, int limitRows) throws SQLException {
if (limitRows != 0 && offset != null) {
limitRows += offset.getValue(session).getInt();
}
int rowNumber = 0;
setCurrentRowNumber(0);
......@@ -307,12 +299,15 @@ public class Select extends Query {
return result;
}
public LocalResult queryWithoutCache(int maxrows) throws SQLException {
if (maxrows != 0) {
if (limit != null) {
maxrows = Math.min(limit.getValue(session).getInt(), maxrows);
public LocalResult queryWithoutCache(int maxRows) throws SQLException {
int limitRows = maxRows;
if (limit != null) {
int l = limit.getValue(session).getInt();
if (limitRows == 0) {
limitRows = l;
} else {
limitRows = Math.min(l, limitRows);
}
limit = ValueExpression.get(ValueInt.get(maxrows));
}
int columnCount = expressions.size();
LocalResult result = new LocalResult(session, expressions, visibleColumnCount);
......@@ -328,13 +323,13 @@ public class Select extends Query {
} else if (isGroupQuery) {
queryGroup(columnCount, result);
} else {
queryFlat(columnCount, result);
queryFlat(columnCount, result, limitRows);
}
if (offset != null) {
result.setOffset(offset.getValue(session).getInt());
}
if (limit != null) {
result.setLimit(limit.getValue(session).getInt());
if (limitRows != 0) {
result.setLimit(limitRows);
}
result.done();
return result;
......
......@@ -16,6 +16,7 @@ import org.h2.constant.SysProperties;
* - Run FindBugs
* - Test with hibernate
* - Update latest version in build.html: http://mirrors.ibiblio.org/pub/mirrors/maven2/com/h2database/h2/
* - Update latest version in mainWeb.html, download.html
* - ant jarClient, check jar file size
*
* - Compile with JDK 1.4, 1.5 and 1.6:
......
......@@ -96,6 +96,7 @@ This command can be used to restore a database from a backup.
The password must be in single quotes. It is case sensitive and can contain spaces.
The compression algorithm must match to the one used when creating the script.
When using encryption, only DEFLATE and LZF are supported.
Instead of a file, an URL may be used.
Admin rights are required to execute this command.
","
RUNSCRIPT FROM 'backup'
......@@ -2516,6 +2517,7 @@ those are used they are read from the file, otherwise (or if they are set to NUL
of the file is interpreted as the column names.
The default charset is the default value for this system, and the default field separator is a comma.
This function can be used like a table: SELECT * FROM CSVREAD(...).
Instead of a file, an URL may be used, for example jar:file:///c:/temp/example.zip!/org/example/nested.zip.
Admin rights are required to execute this command.
","
CALL CSVREAD('test.csv')
......
......@@ -10,8 +10,10 @@ import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.Reader;
import java.net.URL;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Properties;
......@@ -90,7 +92,14 @@ public class FileUtils {
return fileName.startsWith(prefix);
}
public static FileInputStream openFileInputStream(String fileName) throws IOException {
public static InputStream openFileInputStream(String fileName) throws IOException {
if (fileName.indexOf(':') > 1) {
// if the : is in position 1, a windows file access is assumed: C:.. or D:
// otherwise a URL is assumed
URL url = new URL(fileName);
InputStream in = url.openStream();
return in;
}
fileName = translateFileName(fileName);
FileInputStream in = new FileInputStream(fileName);
trace("openFileInputStream", fileName, in);
......@@ -448,7 +457,7 @@ public class FileUtils {
original = translateFileName(original);
copy = translateFileName(copy);
FileOutputStream out = null;
FileInputStream in = null;
InputStream in = null;
try {
out = openFileOutputStream(copy);
in = openFileInputStream(original);
......
......@@ -10,11 +10,42 @@ INSERT INTO CHANNEL VALUES('H2 Database Engine' ,
CREATE TABLE ITEM(ID INT PRIMARY KEY, TITLE VARCHAR, ISSUED TIMESTAMP, DESC VARCHAR);
INSERT INTO ITEM VALUES(29,
'New version available: 1.0.59 (2007-10-03)', '2007-10-03 12:00:00',
'A new version of H2 is available for <a href="http://www.h2database.com">download</a>.
(You may have to click ''Refresh'').
<br />
<b>Changes and new functionality:</b>
<ul><li>Fulltext search is now documented (see Tutorial).
</li><li>H2 Console: Progress information when logging into a H2 embedded database.
</li><li>SCRIPT: the SQL statements in the result set now include the terminating semicolon.
</li></ul>
<b>Bugfixes:</b>
<ul><li>If the process was killed while the database was running,
sometimes the database could not be opened.
</li><li>Comparing columns with constants that are out of range works again.
</li><li>When the data type was unknown in a subquery, sometimes the wrong exception was thrown.
</li><li>Multi-threaded kernel (MULTI_THREADED=1): A synchronization problem has been fixed.
</li><li>A PreparedStatement that was cancelled could not be reused.
</li><li>When the database was closed while logging was disabled (LOG 0),
re-opening the database was slow.
</li><li>The Console did not always refresh the table list when required.
</li><li>When creating a table using CREATE TABLE .. AS SELECT,
the precision for some data types was wrong in some cases.
</li><li>When using the (undocumented) in-memory file system
(jdbc:h2:memFS:x or jdbc:h2:memLZF:x), and using multiple connections,
a ConcurrentModificationException could occur.
</li><li>REGEXP compatibility: now Matcher.find is used.
</li><li>When using a subquery with group by as a table, some columns could not be used.
</li><li>Views with subqueries as tables and queries with nested subqueries as tables did not always work.
</li></ul>
For future plans, see the new ''Roadmap'' page on the web site.
');
INSERT INTO ITEM VALUES(28,
'New version available: 1.0.58 (2007-09-15)', '2007-09-15 12:00:00',
'A new version of H2 is available for <a href="http://www.h2database.com">download</a>.
(You may have to click ''Refresh'').
<br />
<b>Changes and new functionality:</b>
<ul><li>Empty space in the database files is now better reused
......@@ -378,81 +409,6 @@ INSERT INTO ITEM VALUES(21,
For future plans, see the new ''Roadmap'' page on the web site.
');
INSERT INTO ITEM VALUES(20,
'New version available: 1.0 / 2007-01-17', '2007-01-17 12:00:00',
'A new version of H2 is available for <a href="http://www.h2database.com">download</a>.
<br />
<b>Changes and new functionality:</b>
<ul>
<li>The Console is now translated to Japanese thanks to
IKEMOTO, Masahiro (ikeyan (at) arizona (dot) ne (dot) jp).
</li><li>The database engine can now be compiled with JDK 1.3 using ant codeswitch.
There are still some limitations, and the ant script to build the jar does not work yet.
</li><li>SCRIPT NODATA now writes the row count for each table.
</li><li>Timestamps with timezone information (Z or +/-hh:mm) and dates before year 1
can now be parsed. However dates before year 1 are not formatted correctly.
</li></ul>
<b>Bugfixes:</b>
<ul>
<li>Fixed a problem where data in the log file was not written to the data file
(recovery failure) after a crash, if an index was deleted previously.
</li><li>Setting the collation (SET COLLATOR) was very slow on some systems (up to 24 seconds).
</li><li>Selecting a column using the syntax schemaName.tableName.columnName did not work in all cases.
</li><li>When stopping the TCP server from an application and immediately afterwards starting
it again using a different TCP password, an exception was thrown sometimes.
</li><li>Now PreparedStatement.setBigDecimal(..) can only be called with an object of
type java.math.BigDecimal. Derived classes are not allowed any more. Many thanks to
Maciej Wegorkiewicz for finding this problem.
</li><li>It was possible to manipulate values in the byte array after calling PreparedStatement.setBytes,
and this could lead to problems if the same byte array was used again. Now the byte array
is copied if required.
</li><li>Date, time and timestamp objects were cloned in cases where it was not required. Fixed.
</li></ul>
For future plans, see the new ''Roadmap'' page on the web site.
');
INSERT INTO ITEM VALUES(19,
'New version available: 1.0 / 2007-01-02', '2007-01-02 12:00:00',
'A new version of H2 is available for <a href="http://www.h2database.com">download</a>.
<br />
<b>Changes and new functionality:</b>
<ul>
<li>H2 is now available in Maven. The groupId is com.h2database, the
artifactId is h2 and the version 1.0.20061217 (the new version will be
available in a few days). To create the maven artifacts yourself, use
''ant mavenUploadLocal'' and ''ant mavenBuildCentral''.
</li><li>Many settings are now initialized from system properties and can be
changed on the command line without having recompile the database.
See Advances / Settings Read from System Properties.
</li><li>The (relative or absolute) directory where the script files are stored
or read can now be changed using the system property h2.scriptDirectory
</li><li>Client trace files now created in the directory ''trace.db'' and no
longer the application directory. This can be changed using the system
property h2.clientTraceDirectory.
</li><li>Build: Now using ant-build.properties. The JDK is automatically updated
when using ant codeswitch...
</li><li>Cluster: Now the server can detect if a query is read-only, and in this
case the result is only read from the first cluster node. However, there
is currently no load balancing made to avoid problems with transactions
/ locking.
</li></ul>
<b>Bugfixes:</b>
<ul>
<li>If a CLOB or BLOB was deleted in a transaction and the database crashed
before the transaction was committed or rolled back, the object was lost if
it was large. Fixed.
</li><li>Prepared statements with non-constant functions such as
CURRENT_TIMESTAMP() did not get re-evaluated if the result of the
function changed. Fixed.
</li><li>In some situations the log file got corrupt if the process was terminated
while the database was opening.
</li><li>Using ;RECOVER=1 in the database URL threw a syntax exception. Fixed.
</li><li>It was possible to drop the sequence of a temporary tables with DROP
ALL OBJECTS, resulting in a null pointer exception afterwards.
</li></ul>
For future plans, see the new ''Roadmap'' page on the web site.
');
SELECT 'newsfeed-rss.xml' FILE,
XMLSTARTDOC() ||
XMLNODE('rss', XMLATTR('version', '2.0'),
......
......@@ -28,6 +28,7 @@ public class TestPreparedStatement extends TestBase {
deleteDb("preparedStatement");
Connection conn = getConnection("preparedStatement");
testMaxRowsChange(conn);
testUnknownDataType(conn);
testCancelReuse(conn);
testCoalesce(conn);
......@@ -51,6 +52,19 @@ public class TestPreparedStatement extends TestBase {
conn.close();
}
private void testMaxRowsChange(Connection conn) throws Exception {
PreparedStatement prep = conn.prepareStatement("SELECT * FROM SYSTEM_RANGE(1, 100)");
ResultSet rs;
for (int j = 1; j < 20; j++) {
prep.setMaxRows(j);
rs = prep.executeQuery();
for (int i = 0; i < j; i++) {
check(rs.next());
}
checkFalse(rs.next());
}
}
private void testUnknownDataType(Connection conn) throws Exception {
try {
PreparedStatement prep = conn.prepareStatement(
......
......@@ -1543,8 +1543,8 @@ insert into x values(0), (1), (10);
> update count: 3
SELECT t1.ID, (SELECT t1.id || ':' || AVG(t2.ID) FROM X t2) FROM X t1;
> ID SELECT ((T1.ID || ':') || AVG(T2.ID)) FROM PUBLIC.X T2 /* PUBLIC.X_TABLE_SCAN */ LIMIT 2
> -- ----------------------------------------------------------------------------------------
> ID SELECT ((T1.ID || ':') || AVG(T2.ID)) FROM PUBLIC.X T2 /* PUBLIC.X_TABLE_SCAN */
> -- --------------------------------------------------------------------------------
> 0 0:3
> 1 1:3
> 10 10:3
......@@ -1554,8 +1554,8 @@ drop table x;
> ok
select (select t1.x from system_range(1,1) t2) from system_range(1,1) t1;
> SELECT T1.X FROM SYSTEM_RANGE(1, 1) T2 /* PUBLIC.RANGE_INDEX */ LIMIT 2
> -----------------------------------------------------------------------
> SELECT T1.X FROM SYSTEM_RANGE(1, 1) T2 /* PUBLIC.RANGE_INDEX */
> ---------------------------------------------------------------
> 1
> rows: 1
......@@ -1574,11 +1574,11 @@ select * from test order by id;
> rows (ordered): 3
select rownum, (select count(*) from test), rownum from test;
> ROWNUM() SELECT COUNT(*) FROM PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN */ LIMIT 2 /* direct lookup query */ ROWNUM()
> -------- ----------------------------------------------------------------------------------------------- --------
> 1 3 1
> 2 3 2
> 3 3 3
> ROWNUM() SELECT COUNT(*) FROM PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN */ /* direct lookup query */ ROWNUM()
> -------- --------------------------------------------------------------------------------------- --------
> 1 3 1
> 2 3 2
> 3 3 3
> rows: 3
delete from test t0 where rownum<2;
......@@ -2244,8 +2244,8 @@ call /* remark * / * /* ** // end */ 1;
> rows: 1
call (select x from dual where x is null);
> SELECT X FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX */ WHERE X IS NULL LIMIT 2
> ---------------------------------------------------------------------------------
> SELECT X FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX */ WHERE X IS NULL
> -------------------------------------------------------------------------
> null
> rows: 1
......@@ -2321,8 +2321,8 @@ select count(*) from test where id = ((select id from test), 1);
> exception
select (select id from test where 1=0) from test;
> SELECT ID FROM PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN: FALSE */ WHERE FALSE LIMIT 2
> ----------------------------------------------------------------------------------
> SELECT ID FROM PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN: FALSE */ WHERE FALSE
> --------------------------------------------------------------------------
> null
> null
> rows: 2
......@@ -2343,14 +2343,14 @@ insert into test values(1, 'Y');
> update count: 1
call select a from test order by id;
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1 */ LIMIT 2
> ------------------------------------------------------------
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1 */
> ----------------------------------------------------
> TRUE
> rows (ordered): 1
select select a from test order by id;
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1 */ LIMIT 2
> ------------------------------------------------------------
> SELECT A FROM PUBLIC.TEST /* PUBLIC.PRIMARY_KEY_1 */
> ----------------------------------------------------
> TRUE
> rows (ordered): 1
......@@ -5721,19 +5721,19 @@ SELECT * FROM TEST T WHERE T.ID = (SELECT T2.ID FROM TEST T2 WHERE T2.ID=T.ID);
> rows: 3
SELECT (SELECT T2.NAME FROM TEST T2 WHERE T2.ID=T.ID), T.NAME FROM TEST T;
> SELECT T2.NAME FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T.ID */ WHERE T2.ID = T.ID LIMIT 2 NAME
> --------------------------------------------------------------------------------------------------- -----
> Hello Hello
> World World
> null null
> SELECT T2.NAME FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID = T.ID */ WHERE T2.ID = T.ID NAME
> ------------------------------------------------------------------------------------------- -----
> Hello Hello
> World World
> null null
> rows: 3
SELECT (SELECT SUM(T2.ID) FROM TEST T2 WHERE T2.ID>T.ID), T.ID FROM TEST T;
> SELECT SUM(T2.ID) FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID > T.ID */ WHERE T2.ID > T.ID LIMIT 2 ID
> ------------------------------------------------------------------------------------------------------ --
> 2 1
> 3 0
> null 2
> SELECT SUM(T2.ID) FROM PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_1: ID > T.ID */ WHERE T2.ID > T.ID ID
> ---------------------------------------------------------------------------------------------- --
> 2 1
> 3 0
> null 2
> rows: 3
select * from test t where t.id+1 in (select id from test);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论