提交 2a9dc1ec authored 作者: Noel Grandin's avatar Noel Grandin

use regular session for creating view

上级 39fdef7a
...@@ -99,32 +99,19 @@ public class CreateView extends SchemaCommand { ...@@ -99,32 +99,19 @@ public class CreateView extends SchemaCommand {
} }
querySQL = select.getPlanSQL(); querySQL = select.getPlanSQL();
} }
// The view creates a Prepared command object, which belongs to a Column[] columnTemplates = null;
// session, so we pass the system session down. if (columnNames != null) {
Session sysSession = db.getSystemSession(); columnTemplates = new Column[columnNames.length];
synchronized (sysSession) { for (int i = 0; i < columnNames.length; ++i) {
try { columnTemplates[i] = new Column(columnNames[i], Value.UNKNOWN);
Column[] columnTemplates = null;
if (columnNames != null) {
columnTemplates = new Column[columnNames.length];
for (int i = 0; i < columnNames.length; ++i) {
columnTemplates[i] = new Column(columnNames[i], Value.UNKNOWN);
}
}
if (view == null) {
Schema schema = session.getDatabase().getSchema(
session.getCurrentSchemaName());
sysSession.setCurrentSchema(schema);
view = new TableView(getSchema(), id, viewName, querySQL, null,
columnTemplates, sysSession, false, false);
} else {
view.replace(querySQL, columnTemplates, sysSession, false, force, false);
view.setModified();
}
} finally {
sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN));
} }
} }
if (view == null) {
view = new TableView(getSchema(), id, viewName, querySQL, null, columnTemplates, session, false, false);
} else {
view.replace(querySQL, columnTemplates, session, false, force, false);
view.setModified();
}
if (comment != null) { if (comment != null) {
view.setComment(comment); view.setComment(comment);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论