/// <summary> /// Appends an OR restriction to this sub selectes last JOIN statements /// </summary> /// <param name="reference"></param> /// <returns></returns> public DBClause Or(DBClause reference) { IDBBoolean join = (IDBBoolean)this.Joins[this.Joins.Count - 1]; join.Or(reference); return((DBClause)join); }
public DBTableSet On(DBClause parent, Compare comp, DBClause child) { DBComparison compare = DBComparison.Compare(parent, comp, child); this.Last = this.Root.On(compare); return(this); }
/// <summary> /// Appends a new INNER JOIN between this table an the specified table matching between this tables parentfield and the other tables child field /// </summary> /// <param name="table"></param> /// <param name="parentField"></param> /// <param name="childField"></param> /// <returns></returns> public DBJoin InnerJoin(DBTable table, DBClause parentField, DBClause childField) { DBJoin join = DBJoin.InnerJoin(table, parentField, childField, Compare.Equals); this.Joins.Add(join); return(join); }
/// <summary> /// Appends a new RIGHT OUTER JOIN between this table an the specified clause matching on the comparison /// </summary> /// <param name="foreign"></param> /// <param name="compare"></param> /// <returns></returns> public DBJoin RightJoin(DBClause foreign, DBComparison compare) { DBJoin join = DBJoin.Join(foreign, JoinType.RightOuter, compare); this.Joins.Add(join); return(join); }
/// <summary> /// Appends a new INNER JOIN between this table an the specified clause matching with the specified comparison /// </summary> /// <param name="foreign"></param> /// <param name="compare"></param> /// <returns></returns> public DBJoin InnerJoin(DBClause foreign, DBComparison compare) { DBJoin join = DBJoin.InnerJoin(foreign, compare); this.Joins.Add(join); return(join); }
public DBUpdateQuery OrWhere(string owner, string table, string field, Compare op, DBClause right) { _where = _where.Or(owner, table, field, op, right); _last = _where; return(this); }
public DBUpdateQuery AndWhere(string table, string field, Compare op, DBClause right) { _where = _where.And(table, field, op, right); _last = _where; return(this); }
public DBUpdateQuery OrWhere(DBClause left, Compare op, DBClause right) { _where = _where.Or(left, op, right); _last = _where; return(this); }
/// <summary> /// Creates a return statement with value in this script /// </summary> /// <param name="clause"></param> /// <returns></returns> public DBStatement Return(DBClause clause) { DBReturn ret = DBReturn.Return(clause); this.Then(ret); return(ret); }
/// <summary> /// Creates and returns a new DBQueryHintOption with the specified option value and value clause /// </summary> /// <param name="option"></param> /// <param name="value"></param> /// <returns></returns> public static DBQueryHintOption QueryOption(DBQueryOption option, DBClause value) { DBQueryHintOption hint = QueryOption(option); hint.Clause = value; return(hint); }
// // ctor(s) // #region protected DBCreateTableQuery(string owner, string name) /// <summary> /// protected constructor. Use the static factory /// methods to create and instance of this class /// </summary> /// <param name="table"></param> protected DBCreateTableQuery(string owner, string name) { this.TableName = name; this.TableOwner = owner; this.Columns = new DBColumnList(); this._last = null; }
/// <summary> /// Creates and returns a new RETURN xxx statement /// </summary> /// <param name="toreturn">The clause that will be executed by the database and its resultant value returned</param> /// <returns></returns> public static DBReturn Return(DBClause toreturn) { DBReturnRef ret = new DBReturnRef(); ret.ToReturn = toreturn; return(ret); }
internal static DBAssignSet Set(DBClause assignment) { DBAssignSet set = new DBAssignSet(); set.Last = assignment; set.Assignments.Add(assignment); return(set); }
/// <summary> /// Creates a new JOIN of the specified type with no comparison /// </summary> /// <param name="jointo"></param> /// <param name="joinType"></param> /// <returns></returns> public static DBJoin Join(DBClause jointo, JoinType joinType) { DBJoinRef join = new DBJoinRef(); join.JoinedTo = jointo; join.JoinType = joinType; return(join); }
// // static factory methods // #region public static DBOrder OrderBy(Order order, DBClause clause) /// <summary> /// Creates a new OrderBy clause /// </summary> /// <param name="order"></param> /// <param name="clause"></param> /// <returns></returns> public static DBOrder OrderBy(Order order, DBClause clause) { DBOrderRef orderC = new DBOrderRef(); orderC.Order = order; orderC.Clause = clause; return(orderC); }
/// <summary> /// Begins a new SELECT statement with the clause as the first value returned. /// </summary> /// <param name="clause">Any valid SQL clause (DBConst, DBParam, etc.) </param> /// <returns>A new DBSelectQuery to support statement chaining</returns> public static DBSelectQuery Select(DBClause clause) { DBSelectQuery q = new DBSelectQuery(); q.SelectSet = DBSelectSet.Select(clause); q.Last = q.SelectSet; return(q); }
// // Statement Factory methods // #region internal DBClause Aggregate(AggregateFunction func, DBClause dbref) internal DBClause Aggregate(AggregateFunction func, DBClause dbref) { DBAggregate agg = DBAggregate.Aggregate(func, dbref); this.Last = agg; this.Groupings.Add(agg); return(this); }
public static DBSelectSet Select(DBClause fref) { DBSelectSet set = Select(); set.Results.Add(fref); set.Last = fref; return(set); }
/// <summary> /// Adds an INNER JOIN from the results of this sub query to a second foreign clause. /// Use the ON method to add restrictions /// </summary> /// <param name="table"></param> /// <returns></returns> public DBJoin InnerJoin(DBClause table) { DBJoin join = DBJoin.Join(table, JoinType.InnerJoin); this.Joins.Add(join); return(join); }
/// <summary> /// Creates an unary NOT comparison /// </summary> /// <param name="clause"></param> /// <returns></returns> public static DBComparison Not(DBClause clause) { DBUnaryComparisonRef un = new DBUnaryComparisonRef(); un.UnaryOperator = UnaryOp.Not; un.ToOperateOn = clause; return(un); }
/// <summary> /// Appends a new [type] JOIN between this table an the specified clause matching on the comparison /// </summary> /// <param name="table"></param> /// <param name="type"></param> /// <param name="comp"></param> /// <returns></returns> public DBJoin Join(DBClause table, JoinType type, DBComparison comp) { DBJoin join = DBJoin.Join(table, type, comp); this.Joins.Add(join); return(join); }
public static DBSelectSet SelectAggregate(AggregateFunction funct, DBClause field) { DBAggregate agg = DBAggregate.Aggregate(funct, field); DBSelectSet sel = DBSelectSet.Select(agg); sel.Last = agg; return(sel); }
public DBClause Aggregate(AggregateFunction func, DBClause dbref) { DBAggregate agg = DBAggregate.Aggregate(func, dbref); this.Last = agg; this.Results.Add(agg); return(this); }
/// <summary> /// Creates an EXISTS comparison /// </summary> /// <param name="clause"></param> /// <returns></returns> public static DBComparison Exists(DBClause clause) { DBUnaryComparisonRef un = new DBUnaryComparisonRef(); un.UnaryOperator = Perceiveit.Data.UnaryOp.Exists; un.ToOperateOn = clause; return(un); }
// // where methods // #region public DBDeleteQuery Where(DBClause clause, ComparisonOperator compare, DBClause right) + 1 overload /// <summary> /// Creates the first where clause in this DBDeleteQuery using the left and right clauses as operands in the comparison /// </summary> /// <param name="left">The left operand</param> /// <param name="compare">The comparison type - Equals etc...</param> /// <param name="right">The right operand</param> /// <returns>Itself so further statements can be chained</returns> public DBDeleteQuery Where(DBClause left, Compare compare, DBClause right) { DBFilterSet fs = DBFilterSet.Where(left, compare, right); this._where = fs; this._last = fs; return(this); }
/// <summary> /// Creates the first where clause in this DBDeleteQuery using the DBComparison as the filter. /// </summary> /// <param name="compare">The DBComparison to use</param> /// <returns>Itself so further statements can be chained</returns> public DBDeleteQuery Where(DBComparison compare) { DBFilterSet fs = DBFilterSet.Where(compare); this._where = fs; this._last = fs; return(this); }
// // static factory methods // #region public static DBAssign Set(DBClause item, DBClause toValue) /// <summary> /// Creates a new Assignment clause /// </summary> /// <param name="item"></param> /// <param name="toValue"></param> /// <returns></returns> public static DBAssign Set(DBClause item, DBClause toValue) { DBAssignRef aref = new DBAssignRef(); aref._item = item; aref._toval = toValue; return(aref); }
// // static factory method(s) // #region public static DBBooleanOp Compare(DBClause left, BooleanOp op, DBClause right) /// <summary> /// Creates a new DBBooleanOp to compare the left and right clauses using the specified boolean operator /// </summary> /// <param name="left"></param> /// <param name="op"></param> /// <param name="right"></param> /// <returns></returns> public static DBBooleanOp Compare(DBClause left, BooleanOp op, DBClause right) { DBBooleanOpRef oref = new DBBooleanOpRef(); oref.Left = left; oref.Right = right; oref.Operator = op; return(oref); }
internal static DBGroupBySet GroupBy(DBClause clause) { DBGroupBySet grp = GroupBy(); grp.Groupings.Add(clause); grp.Last = clause; return(grp); }
// // static factory methods // #region public static DBComparison Equal(DBClause from, DBClause to) /// <summary> /// Creates an equal comparison for the left and right clauses /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> public static DBComparison Equal(DBClause from, DBClause to) { DBBinaryComparisonRef compref = new DBBinaryComparisonRef(); compref.Left = from; compref.Right = to; compref.CompareOperator = Perceiveit.Data.Compare.Equals; return(compref); }