提交 b786abf8 authored 作者: noelgrandin's avatar noelgrandin

extend support for DB2 "WITH UR" clause to include INSERT statements

上级 362df6d9
...@@ -1070,6 +1070,9 @@ public class Parser { ...@@ -1070,6 +1070,9 @@ public class Parser {
} while (readIf(",")); } while (readIf(","));
} }
} }
if (database.getMode().isolationLevelInSelectOrInsertStatement) {
parseIsolationClause();
}
return command; return command;
} }
...@@ -1769,7 +1772,7 @@ public class Parser { ...@@ -1769,7 +1772,7 @@ public class Parser {
read("ONLY"); read("ONLY");
} }
} }
if (database.getMode().isolationLevelInSelectStatement) { if (database.getMode().isolationLevelInSelectOrInsertStatement) {
parseIsolationClause(); parseIsolationClause();
} }
} }
......
...@@ -131,7 +131,7 @@ public class Mode { ...@@ -131,7 +131,7 @@ public class Mode {
/** /**
* can set the isolation level using WITH {RR|RS|CS|UR} * can set the isolation level using WITH {RR|RS|CS|UR}
*/ */
public boolean isolationLevelInSelectStatement; public boolean isolationLevelInSelectOrInsertStatement;
/** /**
* MySQL style INSERT ... ON DUPLICATE KEY UPDATE ... * MySQL style INSERT ... ON DUPLICATE KEY UPDATE ...
...@@ -149,7 +149,7 @@ public class Mode { ...@@ -149,7 +149,7 @@ public class Mode {
mode.aliasColumnName = true; mode.aliasColumnName = true;
mode.supportOffsetFetch = true; mode.supportOffsetFetch = true;
mode.sysDummy1 = true; mode.sysDummy1 = true;
mode.isolationLevelInSelectStatement = true; mode.isolationLevelInSelectOrInsertStatement = true;
add(mode); add(mode);
mode = new Mode("Derby"); mode = new Mode("Derby");
...@@ -157,7 +157,7 @@ public class Mode { ...@@ -157,7 +157,7 @@ public class Mode {
mode.uniqueIndexSingleNull = true; mode.uniqueIndexSingleNull = true;
mode.supportOffsetFetch = true; mode.supportOffsetFetch = true;
mode.sysDummy1 = true; mode.sysDummy1 = true;
mode.isolationLevelInSelectStatement = true; mode.isolationLevelInSelectOrInsertStatement = true;
add(mode); add(mode);
mode = new Mode("HSQLDB"); mode = new Mode("HSQLDB");
......
...@@ -380,6 +380,7 @@ public class TestCompatibility extends TestBase { ...@@ -380,6 +380,7 @@ public class TestCompatibility extends TestBase {
stat.execute("drop table test if exists"); stat.execute("drop table test if exists");
stat.execute("create table test(id varchar)"); stat.execute("create table test(id varchar)");
res = stat.executeQuery("select * from test with ur"); res = stat.executeQuery("select * from test with ur");
stat.executeUpdate("insert into test values (1) with ur");
res = stat.executeQuery("select * from test where id = 1 with rr"); res = stat.executeQuery("select * from test where id = 1 with rr");
res = stat.executeQuery("select * from test order by id fetch next 2 rows only with rr"); res = stat.executeQuery("select * from test order by id fetch next 2 rows only with rr");
res = stat.executeQuery("select * from test order by id fetch next 2 rows only with rs"); res = stat.executeQuery("select * from test order by id fetch next 2 rows only with rs");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论