提交 999bc736 authored 作者: noelgrandin's avatar noelgrandin

Issue 517: Create or replace view statement has no effect on the others already…

Issue 517: Create or replace view statement has no effect on the others already existing JDBC connection    
上级 c95fa0ee
...@@ -25,6 +25,7 @@ Change Log ...@@ -25,6 +25,7 @@ Change Log
</li><li>Improve error message when dropping an index that belongs to a constraint, </li><li>Improve error message when dropping an index that belongs to a constraint,
specify constraint in error message. specify constraint in error message.
</li><li>Issue 518: java.sql.Connection.commit() freezes after LOB modification with EXCLUSIVE connection </li><li>Issue 518: java.sql.Connection.commit() freezes after LOB modification with EXCLUSIVE connection
</li><li>Issue 517: Create or replace view statement has no effect on the others already existing JDBC connection
</li></ul> </li></ul>
<h2>Version 1.3.174 (2013-10-19)</h2> <h2>Version 1.3.174 (2013-10-19)</h2>
......
...@@ -107,6 +107,7 @@ public class CreateView extends SchemaCommand { ...@@ -107,6 +107,7 @@ public class CreateView extends SchemaCommand {
view = new TableView(getSchema(), id, viewName, querySQL, null, columnNames, sysSession, false); view = new TableView(getSchema(), id, viewName, querySQL, null, columnNames, sysSession, false);
} else { } else {
view.replace(querySQL, columnNames, sysSession, false, force); view.replace(querySQL, columnNames, sysSession, false, force);
view.setModified();
} }
} finally { } finally {
sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN)); sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN));
......
...@@ -42,6 +42,7 @@ public class TestView extends TestBase { ...@@ -42,6 +42,7 @@ public class TestView extends TestBase {
testUnionReconnect(); testUnionReconnect();
testManyViews(); testManyViews();
testReferenceView(); testReferenceView();
testViewAlterAndCommandCache();
deleteDb("view"); deleteDb("view");
} }
...@@ -205,4 +206,25 @@ public class TestView extends TestBase { ...@@ -205,4 +206,25 @@ public class TestView extends TestBase {
conn.close(); conn.close();
deleteDb("view"); deleteDb("view");
} }
/** make sure that when we change a view, that change in reflected in other sessions command cache */
private void testViewAlterAndCommandCache() throws SQLException {
deleteDb("view");
Connection conn = getConnection("view");
Statement stat = conn.createStatement();
stat.execute("create table t0(id int primary key)");
stat.execute("create table t1(id int primary key)");
stat.execute("insert into t0 values(0)");
stat.execute("insert into t1 values(1)");
stat.execute("create view v1 as select * from t0");
ResultSet rs = stat.executeQuery("select * from v1");
assertTrue(rs.next());
assertEquals(0, rs.getInt(1));
stat.execute("create or replace view v1 as select * from t1");
rs = stat.executeQuery("select * from v1");
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
conn.close();
deleteDb("view");
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论