Esempio n. 1
0
 public OrderByItem(string name, SqlOrderByType type)
 {
     this.Type    = type;
     this.Name    = name;
     this.Table   = string.Empty;
     this.IsAlias = true;
 }
Esempio n. 2
0
 public OrderByItem(string name, SqlOrderByType type, string table)
 {
     this.Name    = name;
     this.Table   = table;
     this.Type    = type;
     this.IsAlias = false;
 }
Esempio n. 3
0
        /// <summary>
        /// Generic handler for orderby string
        /// </summary>
        /// <param name="orderby">the orderby string</param>
        protected void BuildOrderBy(string orderby, SqlBuilder builder)
        {
            orderby = orderby.ToLower();

            SqlOrderByType type = SqlOrderByType.ASC;

            if (orderby == "random")
            {
                type = SqlOrderByType.RANDOM;
            }
            else
            {
                int space = orderby.LastIndexOf(' ');
                if (space > -1)
                {
                    string dirType = orderby.Substring(space + 1);
                    orderby = orderby.Substring(0, space);
                    if (dirType == "desc")
                    {
                        type = SqlOrderByType.DESC;
                    }
                    // default to ASC
                }
            }
            builder.AddOrderByItem(null, orderby, type);
        }
Esempio n. 4
0
 public void AddOrderByItem(string name, SqlOrderByType type)
 {
     this.orderBys.Add(new OrderByItem(name, type));
 }
Esempio n. 5
0
 /// <summary>
 /// Collects information for one complete Order By Clause sql statement.
 /// </summary>
 /// <param name="table">The table name</param>
 /// <param name="column">The column name</param>
 /// <param name="type">Order Type, ASC/DESC</param>
 public void AddOrderByItem(string table, string column, SqlOrderByType type)
 {
     this.orderBys.Add(new OrderByItem(column, type, table));
 }