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

--no commit message

--no commit message
上级 e422af10
......@@ -39,6 +39,11 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3>
<h3>Version 1.0.58 (2007-09-15)</h3><ul>
<li>Views with subqueries as tables and queries with nested subqueries as tables did not always work. Fixed.
</li><li>Compatibility: comparing columns with constants that are out of range does not throw an exception.
</li></ul>
<h3>Version 1.0.58 (2007-09-15)</h3><ul>
<li>System.exit is no longer called by the WebServer, the Console and the Server tool
(except to set the exit code if required). This is important when using OSGi.
......
......@@ -814,11 +814,8 @@ public class Parser {
TableView v = new TableView(mainSchema, 0, tempViewName, querySQL, query.getParameters(), null, s,
false);
v.setOwner(session.getUser());
v.setTemporary(true);
table = v;
if (s != database.getSystemSession()) {
table.setOnCommitDrop(true);
}
s.addLocalTempTable(table);
read(")");
} else {
TableFilter top = readTableFilter(fromOuter);
......
......@@ -95,10 +95,21 @@ public class Comparison extends Condition {
dataType = left.getType();
} else {
right = right.optimize(session);
if (left instanceof ExpressionColumn && right.isConstant()) {
right = getCast(right, left.getType(), left.getPrecision(), left.getScale(), session);
} else if (right instanceof ExpressionColumn && left.isConstant()) {
left = getCast(left, right.getType(), right.getPrecision(), right.getScale(), session);
try {
if (left instanceof ExpressionColumn && right.isConstant()) {
right = getCast(right, left.getType(), left.getPrecision(), left.getScale(), session);
} else if (right instanceof ExpressionColumn && left.isConstant()) {
left = getCast(left, right.getType(), right.getPrecision(), right.getScale(), session);
}
} catch (SQLException e) {
int code = e.getErrorCode();
switch(code) {
case ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE:
// WHERE ID=100000000000
return ValueExpression.get(ValueBoolean.get(false));
default:
throw e;
}
}
int lt = left.getType(), rt = right.getType();
if (lt == rt) {
......
......@@ -215,6 +215,17 @@ public class TableView extends Table {
index = null;
invalidate();
}
public String getSQL() {
if (getTemporary()) {
StringBuffer buff = new StringBuffer(querySQL.length());
buff.append("(");
buff.append(querySQL);
buff.append(")");
return buff.toString();
}
return super.getSQL();
}
public Index getScanIndex(Session session) throws SQLException {
if (createException != null) {
......
......@@ -143,14 +143,6 @@ java org.h2.test.TestAll timer
/*
DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
INSERT INTO TEST VALUES(1, 'Hello');
INSERT INTO TEST VALUES(2, 'World');
SELECT * FROM TEST WHERE ID=10000000000;
select * from test where id = 'Hello'; (works in some databases)
Sorry.... I just read the doc and it says using LOG=0 can lead to
corruption...
......
......@@ -59,11 +59,11 @@ public class TestCrashAPI extends TestBase {
// the database in the finalize method
String add = ""; // ";STORAGE=TEXT";
int testing;
// int testing;
// add = ";STORAGE=TEXT";
if (openCount >= 33) {
System.exit(1);
}
// if (openCount >= 33) {
// System.exit(1);
// }
// add = ";LOG=2";
// System.out.println("now open " + openCount);
// add += ";TRACE_LEVEL_FILE=3";
......@@ -96,10 +96,10 @@ public class TestCrashAPI extends TestBase {
String sql = (String) statements.get(i);
try {
if(openCount == 32 && i == 1219) {
int test;
System.out.println("stop!");
}
// if(openCount == 32 && i == 1219) {
// int test;
// System.out.println("stop!");
// }
stat.execute(sql);
} catch (Throwable t) {
printIfBad(seed, -i, -1, t);
......
--- special grammar and test cases ---------------------------------------------------------------------------------------------
select * from dual where x = 1000000000000000000000;
> X
> -
> rows: 0
select * from dual where x = 'Hello';
> exception
CREATE TABLE PARENT(ID INT PRIMARY KEY);
> ok
......@@ -48,7 +56,10 @@ explain select * from test where id = 3;
> rows: 1
explain select * from test where id = 255;
> exception
> PLAN
> -------------------------------------------------------------------------------
> SELECT TEST.ID FROM PUBLIC.TEST /* PUBLIC.TEST_TABLE_SCAN: FALSE */ WHERE FALSE
> rows: 1
drop table test;
> ok
......
select * from (select x from (select x from dual)) where 1=x;
> 1;
CREATE VIEW TEST_VIEW AS SELECT X FROM (SELECT X FROM DUAL);
SELECT * FROM TEST_VIEW;
> 1;
SELECT * FROM TEST_VIEW;
> 1;
DROP VIEW TEST_VIEW;
SELECT X FROM (SELECT X, X AS "XY" FROM DUAL) WHERE X=1;
> 1;
SELECT X FROM (SELECT X, X AS "X Y" FROM DUAL) WHERE X=1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论