Example #1
0
        public bool VisitExprExprMergeNotMatchedInsert(ExprExprMergeNotMatchedInsert expr, TCtx arg)
        {
            var res = this.Visit(expr, "ExprMergeNotMatchedInsert", arg, out var argOut) && this.Accept("And", expr.And, argOut) && this.Accept("Columns", expr.Columns, argOut) && this.Accept("Values", expr.Values, argOut);

            this._visitor.EndVisitExpr(expr, arg);
            return(res);
        }
Example #2
0
        public bool VisitExprExprMergeNotMatchedInsert(ExprExprMergeNotMatchedInsert exprMergeNotMatchedInsert, IExpr?parent)
        {
            if (exprMergeNotMatchedInsert.And != null)
            {
                this.Builder.Append(" AND ");
                exprMergeNotMatchedInsert.And.Accept(this, exprMergeNotMatchedInsert);
            }

            this.AssertNotEmptyList(exprMergeNotMatchedInsert.Values, "Values cannot be empty");

            if (exprMergeNotMatchedInsert.Columns.Count > 0 &&
                exprMergeNotMatchedInsert.Columns.Count != exprMergeNotMatchedInsert.Values.Count)
            {
                throw new SqExpressException("Columns and values numbers do not match");
            }

            this.Builder.Append(" THEN INSERT");
            this.AcceptListComaSeparatedPar('(', exprMergeNotMatchedInsert.Columns, ')', exprMergeNotMatchedInsert);
            this.Builder.Append(" VALUES");
            this.AcceptListComaSeparatedPar('(', exprMergeNotMatchedInsert.Values, ')', exprMergeNotMatchedInsert);

            return(true);
        }
Example #3
0
 public static ExprExprMergeNotMatchedInsert WithValues(this ExprExprMergeNotMatchedInsert original, IReadOnlyList <IExprAssigning> newValues)
 => new ExprExprMergeNotMatchedInsert(and: original.And, columns: original.Columns, values: newValues);
Example #4
0
 public static ExprExprMergeNotMatchedInsert WithColumns(this ExprExprMergeNotMatchedInsert original, IReadOnlyList <ExprColumnName> newColumns)
 => new ExprExprMergeNotMatchedInsert(and: original.And, columns: newColumns, values: original.Values);
Example #5
0
 public static ExprExprMergeNotMatchedInsert WithAnd(this ExprExprMergeNotMatchedInsert original, ExprBoolean?newAnd)
 => new ExprExprMergeNotMatchedInsert(and: newAnd, columns: original.Columns, values: original.Values);