提交 7b482dff authored 作者: Owner's avatar Owner

Undo help.csv change, minor edits in other file

上级 5cad03b9
...@@ -1137,7 +1137,7 @@ public class Parser { ...@@ -1137,7 +1137,7 @@ public class Parser {
String[] querySQLOutput = new String[]{null}; String[] querySQLOutput = new String[]{null};
List<Column> columnTemplateList = createQueryColumnTemplateList(null, command.getQuery(), querySQLOutput); List<Column> columnTemplateList = createQueryColumnTemplateList(null, command.getQuery(), querySQLOutput);
Table temporarySourceTableView = createTemporarySessionView( TableView temporarySourceTableView = createTemporarySessionView(
command.getQueryAlias(), querySQLOutput[0], command.getQueryAlias(), querySQLOutput[0],
columnTemplateList, false/* no recursion */, columnTemplateList, false/* no recursion */,
false/* do not add to session */, false/* do not add to session */,
...@@ -5129,18 +5129,18 @@ public class Parser { ...@@ -5129,18 +5129,18 @@ public class Parser {
List<TableView> viewsCreated = new ArrayList<>(); List<TableView> viewsCreated = new ArrayList<>();
readIf("RECURSIVE"); readIf("RECURSIVE");
// this WITH statement might not be temporary - allow keyword to tell us that // this WITH statement might not be temporary - allow optional keyword to tell us that
// this keyword is a work in progress feature and will not be documented
boolean isPersistent = readIf("PERSISTENT"); boolean isPersistent = readIf("PERSISTENT");
// this WITH statement might not be temporary - it my part of a persistent view // this WITH statement might not be temporary - it may part of a persistent view
// as in CREATE VIEW abc AS WITH // as in CREATE VIEW abc AS WITH - this auto detects that condition
if(session.isParsingView()){ if(session.isParsingView()){
isPersistent = true; isPersistent = true;
} }
do { do {
TableView newView = parseSingleCommonTableExpression(isPersistent); viewsCreated.add(parseSingleCommonTableExpression(isPersistent));
viewsCreated.add(newView);
} while (readIf(",")); } while (readIf(","));
Prepared p = null; Prepared p = null;
...@@ -5227,6 +5227,7 @@ public class Parser { ...@@ -5227,6 +5227,7 @@ public class Parser {
// table expressions need to reference something that look like // table expressions need to reference something that look like
// themselves // themselves
// to work (its removed after creation in this method) // to work (its removed after creation in this method)
// only create table data and table if we don't have a working CTE already
if(oldViewFound == null){ if(oldViewFound == null){
CreateTableData recursiveTableData = new CreateTableData(); CreateTableData recursiveTableData = new CreateTableData();
recursiveTableData.id = database.allocateObjectId(); recursiveTableData.id = database.allocateObjectId();
...@@ -5246,7 +5247,6 @@ public class Parser { ...@@ -5246,7 +5247,6 @@ public class Parser {
read("AS"); read("AS");
read("("); read("(");
Query withQuery = parseSelect(); Query withQuery = parseSelect();
//withQuery.setSession(targetSession);
read(")"); read(")");
columnTemplateList = createQueryColumnTemplateList(cols, withQuery, querySQLOutput); columnTemplateList = createQueryColumnTemplateList(cols, withQuery, querySQLOutput);
...@@ -5255,13 +5255,14 @@ public class Parser { ...@@ -5255,13 +5255,14 @@ public class Parser {
targetSession.removeLocalTempTable(recursiveTable); targetSession.removeLocalTempTable(recursiveTable);
} }
} }
// If it's persistent, a CTE and a TableView - return existing one // If it's persistent, a CTE and a TableView - return existing one, otherwise create new...
if(oldViewFound!=null && isPersistent && oldViewFound instanceof TableView && oldViewFound.isTableExpression()){ if(oldViewFound!=null && isPersistent && oldViewFound instanceof TableView && oldViewFound.isTableExpression()){
return (TableView) oldViewFound; return (TableView) oldViewFound;
} }
TableView view = createTemporarySessionView(tempViewName, TableView view = createTemporarySessionView(tempViewName,
querySQLOutput[0], columnTemplateList, querySQLOutput[0], columnTemplateList,
true/* allowRecursiveQueryDetection */, true, isPersistent); true/* allowRecursiveQueryDetection */, true/* add to session */, isPersistent);
return view; return view;
} }
......
...@@ -101,9 +101,9 @@ public class CreateView extends SchemaCommand { ...@@ -101,9 +101,9 @@ public class CreateView extends SchemaCommand {
} }
// The view creates a Prepared command object, which belongs to a // The view creates a Prepared command object, which belongs to a
// session, so we pass the system session (not the current session) down. // session, so we pass the system session (not the current session) down.
//Session viewSession = select.isTableExpression()!=null ? select.getSession() : db.getSystemSession(); // Why is the SYS session used here ? I think it might cause a problem...
Session viewSession = db.getSystemSession(); Session sysSession = db.getSystemSession();
synchronized (viewSession) { synchronized (sysSession) {
try { try {
Column[] columnTemplates = null; Column[] columnTemplates = null;
if (columnNames != null) { if (columnNames != null) {
...@@ -115,15 +115,15 @@ public class CreateView extends SchemaCommand { ...@@ -115,15 +115,15 @@ public class CreateView extends SchemaCommand {
if (view == null) { if (view == null) {
Schema schema = session.getDatabase().getSchema( Schema schema = session.getDatabase().getSchema(
session.getCurrentSchemaName()); session.getCurrentSchemaName());
viewSession.setCurrentSchema(schema); sysSession.setCurrentSchema(schema);
view = new TableView(getSchema(), id, viewName, querySQL, null, view = new TableView(getSchema(), id, viewName, querySQL, null,
columnTemplates, viewSession, false, false); columnTemplates, sysSession, false, false);
} else { } else {
view.replace(querySQL, columnTemplates, viewSession, false, force, false); view.replace(querySQL, columnTemplates, sysSession, false, force, false);
view.setModified(); view.setModified();
} }
} finally { } finally {
viewSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN)); sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN));
} }
} }
if (comment != null) { if (comment != null) {
......
...@@ -47,14 +47,6 @@ MERGE INTO tableName [ ( columnName [,...] ) ] ...@@ -47,14 +47,6 @@ MERGE INTO tableName [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | select } { VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | select }
"," ","
Updates existing rows, and insert rows that don't exist." Updates existing rows, and insert rows that don't exist."
"Commands (DML)","MERGE USING","
MERGE INTO targetTableName [ [AS] targetAlias]
USING { ( select ) | sourceTableName }[ [AS] sourceAlias ]
ON ( expression )
[ WHEN MATCHED THEN [ update ] [ delete] ]
[ WHEN NOT MATCHED THEN insert ]
","
Updates or deletes existing rows, and insert rows that don't exist."
"Commands (DML)","RUNSCRIPT"," "Commands (DML)","RUNSCRIPT","
RUNSCRIPT FROM fileNameString scriptCompressionEncryption RUNSCRIPT FROM fileNameString scriptCompressionEncryption
[ CHARSET charsetString ] [ CHARSET charsetString ]
...@@ -378,11 +370,6 @@ Switches auto commit on or off." ...@@ -378,11 +370,6 @@ Switches auto commit on or off."
SET CACHE_SIZE int SET CACHE_SIZE int
"," ","
Sets the size of the cache in KB (each KB being 1024 bytes) for the current database." Sets the size of the cache in KB (each KB being 1024 bytes) for the current database."
"Commands (Other)","SET COLUMN_NAMING_RULES","
SET COLUMN_NAMING_RULES = { DEFAULT | EMULATE=... | MAX_IDENTIFIER_LENGTH=... | REGULAR_EXPRESSION_MATCH_ALLOWED=... | REGULAR_EXPRESSION_MATCH_DISALLOWED=... | DEFAULT_COLUMN_NAME_PATTERN=... | GENERATE_UNIQUE_COLUMN_NAMES=...}
","
This setting controls the rules dealing with how column names are generated
in select statements."
"Commands (Other)","SET CLUSTER"," "Commands (Other)","SET CLUSTER","
SET CLUSTER serverListString SET CLUSTER serverListString
"," ","
...@@ -440,10 +427,6 @@ SET JAVA_OBJECT_SERIALIZER ...@@ -440,10 +427,6 @@ SET JAVA_OBJECT_SERIALIZER
{ null | className } { null | className }
"," ","
Sets the object used to serialize and deserialize java objects being stored in column of type OTHER." Sets the object used to serialize and deserialize java objects being stored in column of type OTHER."
"Commands (Other)","SET LAZY_QUERY_EXECUTION","
SET LAZY_QUERY_EXECUTION int
","
Sets the lazy query execution mode."
"Commands (Other)","SET LOG"," "Commands (Other)","SET LOG","
SET LOG int SET LOG int
"," ","
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论