提交 6645bcaf authored 作者: Owner's avatar Owner

Put gurad on testing memory db with CTEs, added lazy never for persistent CTEs

上级 5f78b1cb
...@@ -110,7 +110,7 @@ public class TableView extends Table { ...@@ -110,7 +110,7 @@ public class TableView extends Table {
initColumnsAndTables(session, literalsChecked); initColumnsAndTables(session, literalsChecked);
} }
private static Query compileViewQuery(Session session, String sql, boolean literalsChecked, String viewName) { private Query compileViewQuery(Session session, String sql, boolean literalsChecked, String viewName) {
Prepared p; Prepared p;
session.setParsingView(true,viewName); session.setParsingView(true,viewName);
try { try {
...@@ -121,7 +121,11 @@ public class TableView extends Table { ...@@ -121,7 +121,11 @@ public class TableView extends Table {
if (!(p instanceof Query)) { if (!(p instanceof Query)) {
throw DbException.getSyntaxError(sql, 0); throw DbException.getSyntaxError(sql, 0);
} }
return (Query) p; Query q = (Query) p;
if(isTableExpression){
q.setNeverLazy(true);
}
return q;
} }
/** /**
......
...@@ -761,7 +761,10 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -761,7 +761,10 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest(new TestOutOfMemory()); addTest(new TestOutOfMemory());
addTest(new TestReadOnly()); addTest(new TestReadOnly());
addTest(new TestRecursiveQueries()); addTest(new TestRecursiveQueries());
if(!memory){
// requires persistent store for reconnection tests
addTest(new TestGeneralCommonTableQueries()); addTest(new TestGeneralCommonTableQueries());
}
addTest(new TestRights()); addTest(new TestRights());
addTest(new TestRunscript()); addTest(new TestRunscript());
addTest(new TestSQLInjection()); addTest(new TestSQLInjection());
......
...@@ -124,7 +124,6 @@ public abstract class TestBase { ...@@ -124,7 +124,6 @@ public abstract class TestBase {
* *
* @param seed the random seed value * @param seed the random seed value
*/ */
@SuppressWarnings("unused")
public void testCase(int seed) throws Exception { public void testCase(int seed) throws Exception {
// do nothing // do nothing
} }
......
...@@ -516,7 +516,7 @@ public class TestGeneralCommonTableQueries extends TestBase { ...@@ -516,7 +516,7 @@ public class TestGeneralCommonTableQueries extends TestBase {
+"GROUP BY a) \n" +"GROUP BY a) \n"
+"SELECT \n" +"SELECT \n"
+"A.val, \n" +"A.val, \n"
+"sum(SELECT X FROM BB WHERE BB.a IS A.val)\n"//AS SUM_X +"sum(SELECT X FROM BB WHERE BB.a IS A.val)\n"
+"FROM A \n" +"FROM A \n"
+"GROUP BY A.val"; +"GROUP BY A.val";
...@@ -622,7 +622,7 @@ public class TestGeneralCommonTableQueries extends TestBase { ...@@ -622,7 +622,7 @@ public class TestGeneralCommonTableQueries extends TestBase {
for(int queryRunTries=1;queryRunTries<=maxRetries;queryRunTries++){ for(int queryRunTries=1;queryRunTries<=maxRetries;queryRunTries++){
System.out.println("==================================== Iteration #"+queryRunTries); //System.out.println("==================================== Iteration #"+queryRunTries);
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute(SETUP_SQL); stat.execute(SETUP_SQL);
...@@ -630,12 +630,12 @@ public class TestGeneralCommonTableQueries extends TestBase { ...@@ -630,12 +630,12 @@ public class TestGeneralCommonTableQueries extends TestBase {
// close and re-open connection for one iteration to make sure the query work between connections // close and re-open connection for one iteration to make sure the query work between connections
if(queryRunTries==closeAndReopenDatabaseConnectionOnIteration){ if(queryRunTries==closeAndReopenDatabaseConnectionOnIteration){
System.out.println("Reconnecting to database on iteration#"+queryRunTries+" of "+maxRetries); //System.out.println("Reconnecting to database on iteration#"+queryRunTries+" of "+maxRetries);
conn.close(); conn.close();
conn = getConnection("commonTableExpressionQueries"); conn = getConnection("commonTableExpressionQueries");
} }
System.out.println("=========== test with query"); //System.out.println("=========== test with query");
prep = conn.prepareStatement(WITH_QUERY); prep = conn.prepareStatement(WITH_QUERY);
rs = prep.executeQuery(); rs = prep.executeQuery();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论