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); }
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())); }
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(); } }
public static ExprInsertOutput WithInsert(this ExprInsertOutput original, ExprInsert newInsert) => new ExprInsertOutput(insert: newInsert, outputColumns: original.OutputColumns);
public static ExprInsert WithSource(this ExprInsert original, IExprInsertSource newSource) => new ExprInsert(target: original.Target, targetColumns: original.TargetColumns, source: newSource);
public static ExprInsert WithTargetColumns(this ExprInsert original, IReadOnlyList <ExprColumnName>?newTargetColumns) => new ExprInsert(target: original.Target, targetColumns: newTargetColumns, source: original.Source);
public static ExprInsert WithTarget(this ExprInsert original, IExprTableFullName newTarget) => new ExprInsert(target: newTarget, targetColumns: original.TargetColumns, source: original.Source);
//Insert public bool VisitExprInsert(ExprInsert exprInsert, IExpr?parent) { this.GenericInsert(exprInsert, null, null); return(true); }
public static ExprIdentityInsert WithInsert(this ExprIdentityInsert original, ExprInsert newInsert) => new ExprIdentityInsert(insert: newInsert, identityColumns: original.IdentityColumns);
public static ExprInsertOutput Output(this ExprInsert exprInsert, ExprAliasedColumnName column, params ExprAliasedColumnName[] columns) => new ExprInsertOutput(exprInsert, Helpers.Combine(column, columns));
public ExprIdentityInsert Values(ExprInsertValues values) { var exprInsert = new ExprInsert(this._table.FullName, this._columns, values); return(new ExprIdentityInsert(exprInsert, this.IdentityColumns())); }
public ExprIdentityInsert From(IExprQuery query) { var exprInsert = new ExprInsert(this._table.FullName, this._columns, new ExprInsertQuery(query)); return(new ExprIdentityInsert(exprInsert, this.IdentityColumns())); }