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

Alter table is now supported even if a table has views defined.

上级 e450ca36
...@@ -109,6 +109,7 @@ public class Database implements DataHandler { ...@@ -109,6 +109,7 @@ public class Database implements DataHandler {
private Schema mainSchema; private Schema mainSchema;
private Schema infoSchema; private Schema infoSchema;
private int nextSessionId; private int nextSessionId;
private int nextTempTableId;
private User systemUser; private User systemUser;
private Session systemSession; private Session systemSession;
private TableData meta; private TableData meta;
...@@ -1842,17 +1843,14 @@ public class Database implements DataHandler { ...@@ -1842,17 +1843,14 @@ public class Database implements DataHandler {
/** /**
* Get a unique temporary table name. * Get a unique temporary table name.
* *
* @param sessionId the session id * @param session the session
* @return a unique name * @return a unique name
*/ */
public String getTempTableName(int sessionId) { public synchronized String getTempTableName(Session session) {
String tempName; String tempName;
for (int i = 0;; i++) { do {
tempName = Constants.TEMP_TABLE_PREFIX + sessionId + "_" + i; tempName = Constants.TEMP_TABLE_PREFIX + session.getId() + "_" + nextTempTableId++;
if (mainSchema.findTableOrView(null, tempName) == null) { } while (mainSchema.findTableOrView(session, tempName) != null);
break;
}
}
return tempName; return tempName;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论