提交 d76b3a99 authored 作者: Thomas Mueller's avatar Thomas Mueller

Temporary linked tables are now supported.

上级 2a754e01
...@@ -53,7 +53,13 @@ public class TableView extends Table { ...@@ -53,7 +53,13 @@ public class TableView extends Table {
initColumnsAndTables(session); initColumnsAndTables(session);
} }
private Query recompileQuery(Session session) throws SQLException { /**
* Re-compile the query, updating the SQL statement.
*
* @param session the session
* @return the query
*/
public Query recompileQuery(Session session) throws SQLException {
Prepared p = session.prepare(querySQL); Prepared p = session.prepare(querySQL);
if (!(p instanceof Query)) { if (!(p instanceof Query)) {
throw Message.getSyntaxError(querySQL, 0); throw Message.getSyntaxError(querySQL, 0);
...@@ -91,9 +97,6 @@ public class TableView extends Table { ...@@ -91,9 +97,6 @@ public class TableView extends Table {
cols = new Column[list.size()]; cols = new Column[list.size()];
list.toArray(cols); list.toArray(cols);
createException = null; createException = null;
if (getId() != 0) {
addViewToTables();
}
viewQuery = query; viewQuery = query;
} catch (SQLException e) { } catch (SQLException e) {
createException = e; createException = e;
...@@ -114,6 +117,9 @@ public class TableView extends Table { ...@@ -114,6 +117,9 @@ public class TableView extends Table {
} }
setColumns(cols); setColumns(cols);
if (getId() != 0) {
addViewToTables();
}
} }
/** /**
...@@ -159,6 +165,15 @@ public class TableView extends Table { ...@@ -159,6 +165,15 @@ public class TableView extends Table {
buff.append(columns[i].getSQL()); buff.append(columns[i].getSQL());
} }
buff.append(")"); buff.append(")");
} else if (columnNames != null) {
buff.append('(');
for (int i = 0; i < columnNames.length; i++) {
if (i > 0) {
buff.append(", ");
}
buff.append(columnNames[i]);
}
buff.append(")");
} }
buff.append(" AS\n"); buff.append(" AS\n");
buff.append(querySQL); buff.append(querySQL);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论