public static QsiTableExpressionNode VisitSelectStatement(SelectStatementContext context) { return(TreeHelper.Create <QsiTableExpressionNode>(n => { n.Table.SetValue(TableVisitor.VisitSelectStatement(context)); })); }
public static QsiActionNode VisitInsertStatement(InsertStatementContext context) { var node = new QsiDataInsertActionNode { ConflictBehavior = context.IGNORE() != null ? QsiDataConflictBehavior.Ignore : QsiDataConflictBehavior.None }; if (context.tableName() == null) { throw new QsiException(QsiError.Syntax); } node.Target.SetValue(TableVisitor.VisitTableName(context.tableName())); switch (context.insertStatementValue()) { case SubqueryInsertStatementContext _: { throw TreeHelper.NotSupportedFeature("subquery insert"); } case ExpressionInsertStatementContext expressionContext: { if (context.columns != null) { node.Columns = context.columns.uid() .Select(i => new QsiQualifiedIdentifier(IdentifierVisitor.VisitUid(i))) .ToArray(); } IEnumerable <QsiRowValueExpressionNode> rows = expressionContext .expressionsWithDefaults() .Select(ExpressionVisitor.VisitExpressionsWithDefaults); node.Values.AddRange(rows); break; } case JsonInsertStatementContext jsonContext: { (JObject, JsonObjectContext x)[] objects = jsonContext.jsonObject()