public virtual void VisitInsert(InsertStatementNode node) { }
public virtual void VisitInsert(InsertStatementNode node) { if (node.ValuesInsert != null) VisitValuesInsert(node.ValuesInsert); }
private void BuildInsert(InsertStatementNode node) { InsertIntoTable.Build(node, statements); }
public static void Build(InsertStatementNode node, ICollection<SqlStatement> statements) { if (node.ValuesInsert != null) { var valueInsert = node.ValuesInsert; var values = valueInsert.Values.Select(setNode => setNode.Values.Select(ExpressionBuilder.Build).ToArray()).ToList(); statements.Add(new InsertStatement(node.TableName, node.ColumnNames, values)); } else if (node.SetInsert != null) { var assignments = node.SetInsert.Assignments; var columnNames = new List<string>(); var values = new List<SqlExpression>(); foreach (var assignment in assignments) { var columnName = assignment.ColumnName; var value = ExpressionBuilder.Build(assignment.Value); columnNames.Add(columnName); values.Add(value); } statements.Add(new InsertStatement(node.TableName, columnNames.ToArray(), new[] {values.ToArray()})); } else if (node.QueryInsert != null) { var queryInsert = node.QueryInsert; var queryExpression = ExpressionBuilder.Build(queryInsert.QueryExpression) as SqlQueryExpression; if (queryExpression == null) throw new SqlParseException(); statements.Add(new InsertSelectStatement(node.TableName, node.ColumnNames, queryExpression)); } }