提交 207f063c authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 36d52017
......@@ -78,8 +78,8 @@ or by using Statement.setMaxRows(max).
<h3>Large Result Sets and External Sorting</h3>
<p>
For result set larger than 1000 rows, the result is buffered to disk. If ORDER BY is used,
the sorting is done using an external sort algorithm. In this case, each block of rows is sorted using
For large result set, the result is buffered to disk. The threshold can be defined using the statement SET MAX_MEMORY_ROWS.
If ORDER BY is used, the sorting is done using an external sort algorithm. In this case, each block of rows is sorted using
quick sort, then written to disk; when reading the data, the blocks are merged together.
</p>
......
......@@ -16,7 +16,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>H2 Console: The progress display when opening a database has been improved.
<ul><li>ORDER BY on tableName.columnName didn't work correctly if the column
name was also used as an alias.
</li><li>H2 Console: The progress display when opening a database has been improved.
</li><li>The error message when the server doesn't start has been improved.
</li><li>Key values can now be changed in updatable result sets.
</li><li>Changes in updatable result sets are now visible even when resetting the result set.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
setlocal
cd ../..
rem call java16
rem call build all
rem makensis /v2 src/installer/h2.nsi
rem soffice.exe -invisible macro:///Standard.Module1.H2Pdf
......@@ -1279,7 +1279,7 @@ public class Parser {
Query command = parseSelectSub();
return parseSelectUnionExtension(command, start, false);
}
private Query parseSelectUnionExtension(Query command, int start, boolean unionOnly) throws SQLException {
while (true) {
if (readIf("UNION")) {
......@@ -1306,7 +1306,15 @@ public class Parser {
break;
}
}
if (!unionOnly && readIf("ORDER")) {
if (!unionOnly) {
parseEndOfQuery(command);
}
setSQL(command, null, start);
return command;
}
private void parseEndOfQuery(Query command) throws SQLException {
if (readIf("ORDER")) {
read("BY");
Select oldSelect = currentSelect;
if (command instanceof Select) {
......@@ -1346,7 +1354,34 @@ public class Parser {
command.setOrder(orderList);
currentSelect = oldSelect;
}
if (!unionOnly && readIf("LIMIT")) {
int test;
if (database.getMode().supportOffsetFetch) {
if (readIf("OFFSET")) {
Select temp = currentSelect;
// make sure aggregate functions will not work here
currentSelect = null;
command.setOffset(readExpression().optimize(session));
if (!readIf("ROW")) {
read("ROWS");
}
currentSelect = temp;
}
if (readIf("FETCH")) {
Select temp = currentSelect;
// make sure aggregate functions will not work here
currentSelect = null;
if (readIf("FIRST")) {
Expression limit = readExpression().optimize(session);
command.setLimit(limit);
if (!readIf("ROW")) {
read("ROWS");
}
readIf("ONLY");
}
currentSelect = temp;
}
}
if (readIf("LIMIT")) {
Select temp = currentSelect;
// make sure aggregate functions will not work here
currentSelect = null;
......@@ -1367,7 +1402,7 @@ public class Parser {
}
currentSelect = temp;
}
if (!unionOnly && readIf("FOR")) {
if (readIf("FOR")) {
if (readIf("UPDATE")) {
if (readIf("OF")) {
do {
......@@ -1387,8 +1422,6 @@ public class Parser {
}
}
}
setSQL(command, null, start);
return command;
}
private Query parseSelectSub() throws SQLException {
......@@ -2943,7 +2976,7 @@ public class Parser {
if (len == 0) {
throw getSyntaxError();
}
return getSaveTokenType(s);
return getSaveTokenType(s, database.getMode().supportOffsetFetch);
}
/**
......@@ -2952,14 +2985,14 @@ public class Parser {
* @param s the token to check
* @return true if it is a keyword
*/
public static boolean isKeyword(String s) {
public static boolean isKeyword(String s, boolean supportOffsetFetch) {
if (s == null || s.length() == 0) {
return false;
}
return getSaveTokenType(s) != IDENTIFIER;
return getSaveTokenType(s, supportOffsetFetch) != IDENTIFIER;
}
private static int getSaveTokenType(String s) {
private static int getSaveTokenType(String s, boolean supportOffsetFetch) {
switch (s.charAt(0)) {
case 'C':
if (s.equals("CURRENT_TIMESTAMP")) {
......@@ -2984,6 +3017,8 @@ public class Parser {
return KEYWORD;
} else if ("FULL".equals(s)) {
return KEYWORD;
} else if (supportOffsetFetch && "FETCH".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "FALSE", FALSE);
case 'G':
......@@ -3016,6 +3051,8 @@ public class Parser {
case 'O':
if ("ON".equals(s)) {
return KEYWORD;
} else if (supportOffsetFetch && "OFFSET".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "ORDER", KEYWORD);
case 'P':
......@@ -3476,7 +3513,7 @@ public class Parser {
boolean ifNotExists = readIfNoExists();
String constantName = readIdentifierWithSchema();
Schema schema = getSchema();
if (isKeyword(constantName)) {
if (isKeyword(constantName, false)) {
throw Message.getSQLException(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName);
}
read("VALUE");
......@@ -3493,7 +3530,7 @@ public class Parser {
CreateAggregate command = new CreateAggregate(session);
command.setForce(force);
String name = readUniqueIdentifier();
if (isKeyword(name) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
if (isKeyword(name, false) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
throw Message.getSQLException(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);
}
command.setName(name);
......@@ -3597,7 +3634,7 @@ public class Parser {
CreateFunctionAlias command = new CreateFunctionAlias(session);
command.setForce(force);
String name = readUniqueIdentifier();
if (isKeyword(name) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
if (isKeyword(name, false) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
throw Message.getSQLException(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);
}
command.setAliasName(name);
......@@ -4550,7 +4587,7 @@ public class Parser {
return StringUtils.quoteIdentifier(s);
}
}
if (Parser.isKeyword(s)) {
if (Parser.isKeyword(s, true)) {
return StringUtils.quoteIdentifier(s);
}
return s;
......
......@@ -267,7 +267,7 @@ public abstract class Query extends Prepared {
int idx = expressions.size();
if (e instanceof ExpressionColumn) {
ExpressionColumn exprCol = (ExpressionColumn) e;
String alias = exprCol.getOriginalAliasName();
String tableAlias = exprCol.getOriginalTableAliasName();
String col = exprCol.getOriginalColumnName();
for (int j = 0; j < visible; j++) {
boolean found = false;
......@@ -275,15 +275,15 @@ public abstract class Query extends Prepared {
if (ec instanceof ExpressionColumn) {
ExpressionColumn c = (ExpressionColumn) ec;
found = col.equals(c.getColumnName());
if (alias != null && found) {
String ca = c.getOriginalAliasName();
if (tableAlias != null && found) {
String ca = c.getOriginalTableAliasName();
if (ca != null) {
found = alias.equals(ca);
found = tableAlias.equals(ca);
}
}
} else if (!(ec instanceof Alias)) {
continue;
} else if (col.equals(ec.getAlias())) {
} else if (tableAlias == null && col.equals(ec.getAlias())) {
found = true;
} else {
Expression ec2 = ec.getNonAliasExpression();
......
......@@ -7,58 +7,62 @@
package org.h2.engine;
/*
* Release checklist
* Release checklist:
*
* - Test with Hibernate
* - Run FindBugs
* - build jarClient, check jar file size
* - build jar, test with IKVM
* - build javadocImpl
* - Compile with JDK 1.6:
* java16
* build compile
* set classpath=
* build javadoc
* build javadocImpl (to find missing javadocs)
* - reset to JDK 1.4
* build compile
* java16
* compile
* - Change version and build number in
* Constants.java
* build jarClient
* - Check jar file size
* build jar
* build javadocImpl
* java16
* build compile
* set classpath=
* build javadoc
* build javadocImpl
* - Check if missing javadocs
* java14
* build compile
* java16
* compile
* - Change version and build number in Constants.java
* - Maybe increase TCP_DRIVER_VERSION (old clients must be compatible!)
* - Check code coverage
* - No " Message.get" (must be "throw Message.get")
* - Check that is no TODO in the docs
* - Run regression test with JDK 1.4 and 1.5
* - Use latest versions of other dbs (Derby 10.4.1.3;
* PostgreSQL 8.3.1; MySQL 5.0.51)
* - Use latest versions of other dbs
* Derby 10.4.1.3
* PostgreSQL 8.3.1
* MySQL 5.0.51
* - Change version(s) in performance.html
* - Run 'build benchmark' (with JDK 1.4 currently)
* java14
* build benchmark
* - Copy the benchmark results and update the performance page and diagram
* - Documentation: check if all Javadoc files are in the index
* - Update the changelog (add new version)
* - Update the newsfeed
* - build docs
* build docs
* - Check dataWeb/index.html, versions and links in main, downloads, build
* - PDF
* - footer
* - front page
* - orphan control
* - check images
* - table of contents
* - Use java 1.4
* - build all
* soffice.exe -invisible macro:///Standard.Module1.H2Pdf
* - Check in the PDF file:
* - footer
* - front page
* - orphan control
* - check images
* - table of contents
* java14
* build all
* - Copy the pdf file to h2/docs
* - build zip
* - Windows installer (nsis)
* build zip
* makensis /v2 src/installer/h2.nsi
* - Test Console
* - Test all languages
* - Scan for viruses
* - build mavenDeployCentral
* build mavenDeployCentral
* - Upload to SourceForge
* - java16
* - build compile
* - refresh
* java16
* build compile
* - svn commit
* - svn copy: /svn/trunk /svn/tags/version-1.0.x; Version 1.0.x (yyyy-mm-dd)
* - Newsletter: prepare (always to BCC!!)
......
......@@ -80,6 +80,12 @@ public class Mode {
*/
public boolean uniqueIndexSingleNull;
/**
* If the syntax [OFFSET .. ROW] [FETCH ... ONLY] should be supported.
* This is an alternative syntax for LIMIT .. OFFSET.
*/
public boolean supportOffsetFetch;
private String name;
static {
......
......@@ -199,7 +199,7 @@ public class ExpressionColumn extends Expression {
return columnName;
}
public String getOriginalAliasName() {
public String getOriginalTableAliasName() {
return tableAlias;
}
......
......@@ -314,7 +314,7 @@ implements Trigger, CloseListener
Parser p = new Parser(session);
String tab = q.substring(0, idx);
ExpressionColumn expr = (ExpressionColumn) p.parseExpression(tab);
String schemaName = expr.getOriginalAliasName();
String schemaName = expr.getOriginalTableAliasName();
String tableName = expr.getColumnName();
q = q.substring(idx + " WHERE ".length());
Object[][] columnData = parseKey(conn, q);
......
......@@ -391,7 +391,7 @@ public class DbContextRule implements Rule {
return null;
}
String alias = up.substring(0, i);
if (Parser.isKeyword(alias)) {
if (Parser.isKeyword(alias, true)) {
return null;
}
return query.substring(alias.length());
......@@ -414,7 +414,7 @@ public class DbContextRule implements Rule {
return null;
}
String alias = up.substring(0, i);
if (Parser.isKeyword(alias)) {
if (Parser.isKeyword(alias, true)) {
return null;
}
if (add) {
......
......@@ -270,6 +270,18 @@ java org.h2.test.TestAll timer
/*
drop table test;
create table test(a int);
insert into test values(1);
insert into test values(2);
select -test.a a from test order by test.a;
select -test.a from test order by test.a;
select -test.a aa from test order by a;
select -test.a aa from test order by aa;
select -test.a a from test order by test.a;
select -test.a a from test order by a;
drop all objects;
create domain email as varchar;
create table test(e email);
......@@ -289,8 +301,15 @@ https://bugs.eclipse.org/bugs/show_bug.cgi?id=137701
Support large updates (use the transaction log to undo).
H2 Console: support single file upload and directory download (optional)
document FTL_SEARCH, FTL_SEARCH_DATA
find quote:
You can't make a system that will not lose data, you can only make
a system that knows the last save point of 100% integrity. There are
too many variables and too much randomness on a cold hard power failure.
JaQu
row level locking
......
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(a int);
> ok
insert into test values(1), (2);
> update count: 2
select -test.a a from test order by test.a;
> A
> --
> -1
> -2
> rows (ordered): 2
select -test.a from test order by test.a;
> - TEST.A
> --------
> -1
> -2
> rows (ordered): 2
select -test.a aa from test order by a;
> AA
> --
> -1
> -2
> rows (ordered): 2
select -test.a aa from test order by aa;
> AA
> --
> -2
> -1
> rows (ordered): 2
select -test.a a from test order by a;
> A
> --
> -2
> -1
> rows (ordered): 2
drop table test;
> ok
CREATE TABLE table_a(a_id INT PRIMARY KEY, left_id INT, right_id INT);
> ok
......
......@@ -11,6 +11,7 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import org.h2.engine.Constants;
import org.h2.util.StringUtils;
/**
......@@ -52,6 +53,8 @@ public class MergeDocs {
writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>");
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>Version " + Constants.getFullVersion() + "</p>");
writer.println(finalText);
writer.println("</body></html>");
writer.close();
......
......@@ -548,4 +548,7 @@ usable weblica jena preserved instrumentation inspect jayaprakash ashwin
varargs automate couldn unclear eat dtp disks tablespaces great reproduces
hhh overridden sqle propogation buildid tsv monospace microarrays pathogen
geocoder geocoding longitude estimating microarray latitude magnolia pfgrc
refill analyzers patches popular came growing indication
\ No newline at end of file
refill analyzers patches popular came growing indication arabic graphic toc
numbering goto outline makensis macro hyperlink dispatch setlocal wend
widows msgbox designer styles families uno soffice orphans stan ucb rem
pdfurl upate pagebreak
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论