예제 #1
0
        public bool VisitExprInsert(ExprInsert expr, TCtx arg)
        {
            var res = this.Visit(expr, "Insert", arg, out var argOut) && this.Accept("Target", expr.Target, argOut) && this.Accept("TargetColumns", expr.TargetColumns, argOut) && this.Accept("Source", expr.Source, argOut);

            this._visitor.EndVisitExpr(expr, arg);
            return(res);
        }
예제 #2
0
        public ExprIdentityInsert Values(IEnumerable <IReadOnlyList <ExprValue> > values)
        {
            var rows       = InsertBuilder.BuildInsertValues(values: values);
            var exprInsert = new ExprInsert(this._table.FullName, this._columns, new ExprInsertValues(rows));

            return(new ExprIdentityInsert(exprInsert, this.IdentityColumns()));
        }
예제 #3
0
        protected void GenericInsert(ExprInsert exprInsert, Action?middleHandler, Action?endHandler)
        {
            this.Builder.Append("INSERT INTO ");
            exprInsert.Target.Accept(this, exprInsert);
            if (exprInsert.TargetColumns != null)
            {
                this.AssertNotEmptyList(exprInsert.TargetColumns, "Insert column list cannot be empty");
                this.AcceptListComaSeparatedPar('(', exprInsert.TargetColumns, ')', exprInsert);
            }

            if (middleHandler != null)
            {
                this.Builder.Append(' ');
                middleHandler();
            }
            this.Builder.Append(' ');
            exprInsert.Source.Accept(this, exprInsert);
            if (endHandler != null)
            {
                this.Builder.Append(' ');
                endHandler();
            }
        }
예제 #4
0
 public static ExprInsertOutput WithInsert(this ExprInsertOutput original, ExprInsert newInsert)
 => new ExprInsertOutput(insert: newInsert, outputColumns: original.OutputColumns);
예제 #5
0
 public static ExprInsert WithSource(this ExprInsert original, IExprInsertSource newSource)
 => new ExprInsert(target: original.Target, targetColumns: original.TargetColumns, source: newSource);
예제 #6
0
 public static ExprInsert WithTargetColumns(this ExprInsert original, IReadOnlyList <ExprColumnName>?newTargetColumns)
 => new ExprInsert(target: original.Target, targetColumns: newTargetColumns, source: original.Source);
예제 #7
0
 public static ExprInsert WithTarget(this ExprInsert original, IExprTableFullName newTarget)
 => new ExprInsert(target: newTarget, targetColumns: original.TargetColumns, source: original.Source);
예제 #8
0
        //Insert

        public bool VisitExprInsert(ExprInsert exprInsert, IExpr?parent)
        {
            this.GenericInsert(exprInsert, null, null);
            return(true);
        }
예제 #9
0
 public static ExprIdentityInsert WithInsert(this ExprIdentityInsert original, ExprInsert newInsert)
 => new ExprIdentityInsert(insert: newInsert, identityColumns: original.IdentityColumns);
예제 #10
0
 public static ExprInsertOutput Output(this ExprInsert exprInsert, ExprAliasedColumnName column, params ExprAliasedColumnName[] columns)
 => new ExprInsertOutput(exprInsert, Helpers.Combine(column, columns));
예제 #11
0
        public ExprIdentityInsert Values(ExprInsertValues values)
        {
            var exprInsert = new ExprInsert(this._table.FullName, this._columns, values);

            return(new ExprIdentityInsert(exprInsert, this.IdentityColumns()));
        }
예제 #12
0
        public ExprIdentityInsert From(IExprQuery query)
        {
            var exprInsert = new ExprInsert(this._table.FullName, this._columns, new ExprInsertQuery(query));

            return(new ExprIdentityInsert(exprInsert, this.IdentityColumns()));
        }