提交 a19a9098 authored 作者: Noel Grandin's avatar Noel Grandin

drop TableView isPersistent field

it is redundant, we already have the isTemporary field in a superclass
上级 6f846985
...@@ -1150,7 +1150,7 @@ public class Select extends Query { ...@@ -1150,7 +1150,7 @@ public class Select extends Query {
TableView tableView = t.isView() ? (TableView) t : null; TableView tableView = t.isView() ? (TableView) t : null;
if (tableView != null && tableView.isRecursive() && tableView.isTableExpression()) { if (tableView != null && tableView.isRecursive() && tableView.isTableExpression()) {
if (tableView.isPersistent()) { if (!tableView.isTemporary()) {
// skip the generation of plan SQL for this already recursive persistent CTEs, // skip the generation of plan SQL for this already recursive persistent CTEs,
// since using a with statement will re-create the common table expression // since using a with statement will re-create the common table expression
// views. // views.
......
...@@ -63,14 +63,13 @@ public class TableView extends Table { ...@@ -63,14 +63,13 @@ public class TableView extends Table {
private ResultInterface recursiveResult; private ResultInterface recursiveResult;
private boolean isRecursiveQueryDetected; private boolean isRecursiveQueryDetected;
private boolean isTableExpression; private boolean isTableExpression;
private boolean isPersistent;
public TableView(Schema schema, int id, String name, String querySQL, public TableView(Schema schema, int id, String name, String querySQL,
ArrayList<Parameter> params, Column[] columnTemplates, Session session, ArrayList<Parameter> params, Column[] columnTemplates, Session session,
boolean allowRecursive, boolean literalsChecked, boolean isTableExpression, boolean isPersistent) { boolean allowRecursive, boolean literalsChecked, boolean isTableExpression, boolean isPersistent) {
super(schema, id, name, false, true); super(schema, id, name, false, true);
init(querySQL, params, columnTemplates, session, allowRecursive, literalsChecked, isTableExpression, setTemporary(!isPersistent);
isPersistent); init(querySQL, params, columnTemplates, session, allowRecursive, literalsChecked, isTableExpression);
} }
/** /**
...@@ -92,11 +91,11 @@ public class TableView extends Table { ...@@ -92,11 +91,11 @@ public class TableView extends Table {
init(querySQL, null, init(querySQL, null,
newColumnTemplates == null ? this.columnTemplates newColumnTemplates == null ? this.columnTemplates
: newColumnTemplates, : newColumnTemplates,
session, recursive, literalsChecked, isTableExpression, isPersistent); session, recursive, literalsChecked, isTableExpression);
DbException e = recompile(session, force, true); DbException e = recompile(session, force, true);
if (e != null) { if (e != null) {
init(oldQuerySQL, null, oldColumnTemplates, session, oldRecursive, init(oldQuerySQL, null, oldColumnTemplates, session, oldRecursive,
literalsChecked, isTableExpression, isPersistent); literalsChecked, isTableExpression);
recompile(session, true, false); recompile(session, true, false);
throw e; throw e;
} }
...@@ -104,13 +103,12 @@ public class TableView extends Table { ...@@ -104,13 +103,12 @@ public class TableView extends Table {
private synchronized void init(String querySQL, ArrayList<Parameter> params, private synchronized void init(String querySQL, ArrayList<Parameter> params,
Column[] columnTemplates, Session session, boolean allowRecursive, boolean literalsChecked, Column[] columnTemplates, Session session, boolean allowRecursive, boolean literalsChecked,
boolean isTableExpression, boolean isPersistent) { boolean isTableExpression) {
this.querySQL = querySQL; this.querySQL = querySQL;
this.columnTemplates = columnTemplates; this.columnTemplates = columnTemplates;
this.allowRecursive = allowRecursive; this.allowRecursive = allowRecursive;
this.isRecursiveQueryDetected = false; this.isRecursiveQueryDetected = false;
this.isTableExpression = isTableExpression; this.isTableExpression = isTableExpression;
this.isPersistent = isPersistent;
index = new ViewIndex(this, querySQL, params, allowRecursive); index = new ViewIndex(this, querySQL, params, allowRecursive);
initColumnsAndTables(session, literalsChecked); initColumnsAndTables(session, literalsChecked);
} }
...@@ -716,10 +714,6 @@ public class TableView extends Table { ...@@ -716,10 +714,6 @@ public class TableView extends Table {
return tables; return tables;
} }
public boolean isPersistent() {
return isPersistent;
}
/** /**
* Create a view. * Create a view.
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论