/// <summary> /// Renders a single ORDER BY term /// </summary> /// <param name="builder"></param> /// <param name="term"></param> protected virtual void OrderByTerm(StringBuilder builder, OrderByTerm term) { string dir = (term.Direction == OrderByDirection.Descending) ? "desc" : "asc"; QualifiedIdentifier(builder, term.TableAlias, term.Field); builder.AppendFormat(" {0}", dir); }
/// <summary> /// Renders ORDER BY terms /// </summary> /// <param name="builder"></param> /// <param name="orderByTerms"></param> protected virtual void OrderByTerms(StringBuilder builder, OrderByTermCollection orderByTerms) { for (int i = 0; i < orderByTerms.Count; i++) { OrderByTerm term = (OrderByTerm)orderByTerms[i]; if (i > 0) { builder.Append(", "); } OrderByTerm(builder, term); } }
/// <summary> /// Renders a single ORDER BY term /// </summary> /// <param name="builder"></param> /// <param name="term"></param> protected override void OrderByTerm(StringBuilder builder, OrderByTerm term) { string dir = (term.Direction == OrderByDirection.Descending) ? "desc nulls last" : "asc nulls last"; if (term.Exp != null) { Expression(builder, term.Exp); } else { QualifiedIdentifier(builder, term.TableAlias, term.Field); } builder.AppendFormat(" {0}", dir); }
/// <summary> /// Adds an instance of type OrderByTerm to the end of this OrderByTermCollection. /// </summary> /// <param name="value"> /// The OrderByTerm to be added to the end of this OrderByTermCollection. /// </param> public virtual void Add(OrderByTerm value) { this.List.Add(value); }
/// <summary> /// Determines whether a specfic OrderByTerm value is in this OrderByTermCollection. /// </summary> /// <param name="value"> /// The OrderByTerm value to locate in this OrderByTermCollection. /// </param> /// <returns> /// true if value is found in this OrderByTermCollection; /// false otherwise. /// </returns> public virtual bool Contains(OrderByTerm value) { return(this.List.Contains(value)); }
/// <summary> /// Inserts an element into the OrderByTermCollection at the specified index /// </summary> /// <param name="index"> /// The index at which the OrderByTerm is to be inserted. /// </param> /// <param name="value"> /// The OrderByTerm to insert. /// </param> public virtual void Insert(int index, OrderByTerm value) { this.List.Insert(index, value); }
/// <summary> /// Removes the first occurrence of a specific OrderByTerm from this OrderByTermCollection. /// </summary> /// <param name="value"> /// The OrderByTerm value to remove from this OrderByTermCollection. /// </param> public virtual void Remove(OrderByTerm value) { this.List.Remove(value); }
/// <summary> /// Return the zero-based index of the first occurrence of a specific value /// in this OrderByTermCollection /// </summary> /// <param name="value"> /// The OrderByTerm value to locate in the OrderByTermCollection. /// </param> /// <returns> /// The zero-based index of the first occurrence of the _ELEMENT value if found; /// -1 otherwise. /// </returns> public virtual int IndexOf(OrderByTerm value) { return(this.List.IndexOf(value)); }
/// <summary>Конструктор</summary> internal OrderBy(string field, OrderByDir dir) { Term = new OrderByTerm(field, null, dir); }
/// <summary>Конструктор</summary> internal OrderBy(string field) { Term = new OrderByTerm(field, null, OrderByDir.Asc); }
/// <summary>Конструктор</summary> internal OrderBy(string field, From table) { Term = new OrderByTerm(field, table != null ? table.Term : null, OrderByDir.Asc); }
/// <summary>Конструктор</summary> internal OrderBy(string field, From table, OrderByDir dir) { Term = new OrderByTerm(field, table != null ? table.Term : null, dir); }