/// <summary> /// Adds the column to the insert statement. /// </summary> /// <param name="column">The column to add.</param> public void AddColumn(Column column) { if (column == null) { throw new ArgumentNullException("column"); } _columns.Add(column); }
/// <summary> /// Initializes a new instance of a Setter. /// </summary> /// <param name="column">The name of the column to set.</param> /// <param name="value">The value to set the column to.</param> public Setter(Column column, IProjectionItem value) { if (column == null) { throw new ArgumentNullException("column"); } if (value == null) { throw new ArgumentNullException("value"); } _column = column; _value = value; }
/// <summary> /// Generates the text for a Column builder. /// </summary> /// <param name="item">The Column builder to generate the text for.</param> protected internal override void VisitColumn(Column item) { bool qualify = item.Source != null && (item.Qualify ?? (commandType == CommandType.Select || (commandType == CommandType.Insert && options.QualifyInsertColumns) || (commandType == CommandType.Update && options.QualifyUpdateColumns) || (commandType == CommandType.Delete && options.QualifyDeleteColumns))); if (qualify) { forSourceContext(SourceReferenceType.Reference).visitAliasedSource(item.Source); writer.Write("."); } writer.Write(item.Name); }
private Column buildColumn(MatchResult result) { List<string> parts = new List<string>(); buildMultipartIdentifier(result, parts); if (parts.Count > 1) { Namespace qualifier = getNamespace(parts.Take(parts.Count - 2)); string tableName = parts[parts.Count - 2]; AliasedSource source = scope.GetSource(tableName); string columnName = parts[parts.Count - 1]; return source.Column(columnName); } else { string columnName = parts[0]; Column column; AliasedSource source; if (scope.HasSingleSource(out source)) { column = source.Column(columnName); column.Qualify = false; } else { column = new Column(columnName); } return column; } }
/// <summary> /// Removes the column from the insert statement. /// </summary> /// <param name="column">The column to remove.</param> /// <returns>True if the column was removed; otherwise, false.</returns> public bool RemoveColumn(Column column) { if (column == null) { throw new ArgumentNullException("column"); } return _columns.Remove(column); }
/// <summary> /// Visits a Column builder. /// </summary> /// <param name="item">The item to visit.</param> protected internal virtual void VisitColumn(Column item) { }