public DBUpdateQuery OrWhere(DBClause left, Compare op, DBClause right) { _where = _where.Or(left, op, right); _last = _where; return(this); }
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 Where(DBComparison compare) { DBFilterSet fs = DBFilterSet.Where(compare); this._where = fs; this._last = fs; return(this); }
// // Where... methods // #region public DBUpdateQuery Where(DBClause left, Compare compare, DBClause right) + 1 overload public DBUpdateQuery 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 fields and a series of DBClauses that are evaluated at execution time /// </summary> /// <param name="fld">The field which will be compared to the specified values</param> /// <param name="values">The set of DBClauses to be evaluated and compared</param> /// <returns>Itself so further statements can be chained</returns> public DBDeleteQuery WhereIn(DBField fld, params DBClause[] values) { DBComparison compare = DBComparison.In(fld, values); DBFilterSet fs = DBFilterSet.Where(compare); this._where = fs; this._last = fs; return(this); }
public static DBFilterSet Where(DBComparison compare) { if (null == compare) { throw new ArgumentNullException("compare"); } DBFilterSet fs = new DBFilterSet(); fs.Filters = compare; return(fs); }
/// <summary> /// Creates the first where clause in this DBDeleteQuery using the fields and a sub select that is evaluated at execution time /// </summary> /// <param name="field">The field which will be compared to the specified values</param> /// <param name="select">The sub select to be evaluated and compared</param> /// <returns>Itself so further statements can be chained</returns> public DBDeleteQuery WhereIn(string field, DBSelectQuery select) { DBField fld = DBField.Field(field); DBSubQuery subsel = DBSubQuery.SubSelect(select); DBComparison compare = DBComparison.In(fld, subsel); DBFilterSet fs = DBFilterSet.Where(compare); this._where = fs; this._last = fs; return(this); }
/// <summary> /// Creates a further where clause in this DBDeleteQuery between the specified owner.table.field and the clause. /// Then combines with the previous filter in a boolean OR operation /// </summary> /// <param name="owner">The schema owner of the table</param> /// <param name="table">The table the field belongs to</param> /// <param name="field">The field to compare against</param> /// <param name="op">The comparison operator</param> /// <param name="right">The value clause</param> /// <returns>Itself so further statements can be combined</returns> public DBDeleteQuery OrWhereField(string owner, string table, string field, Compare op, DBClause right) { if (null == _where) { throw new NullReferenceException(Errors.CannotAppendWhereClauseWithoutInitial); } _where = _where.Or(owner, table, field, op, right); _last = _where; return(this); }
/// <summary> /// Creates a futher where clause in this DBDeleteQuery using the left and right /// clauses as operands in the comparison. Then combines with the previous filter in a boolean AND operation /// </summary> /// <param name="left">The left operand</param> /// <param name="op">The comparison type - Equals etc...</param> /// <param name="right">The right operand</param> /// <returns>Itself so further statements can be chained</returns> public DBDeleteQuery OrWhere(DBClause left, Compare op, DBClause right) { if (null == _where) { throw new NullReferenceException(Errors.CannotAppendWhereClauseWithoutInitial); } _where = _where.Or(left, op, right); _last = _where; return(this); }
/// <summary> /// Creates a further where clause in this DBDeleteQuery using the specified comparison. /// Then combines with the previous filter in a boolean OR operation /// </summary> /// <param name="comparison">The comparison filter</param> /// <returns>Itself so further statements can be combined</returns> public DBDeleteQuery OrWhere(DBClause comparison) { if (null == _where) { throw new NullReferenceException(Errors.CannotAppendWhereClauseWithoutInitial); } _where = _where.Or(comparison); _last = _where; return(this); }
/// <summary> /// Creates the first where clause in this DBDeleteQuery using the fields and a series of constant values /// </summary> /// <param name="field">The field which will be compared to the psecified values</param> /// <param name="values">The set of values to limit the deletion to</param> /// <returns>Itself so further statements can be chained</returns> public DBDeleteQuery WhereIn(string field, params object[] values) { DBField fld = DBField.Field(field); List <DBClause> items = new List <DBClause>(); if (values != null && values.Length > 0) { foreach (object val in values) { items.Add(DBConst.Const(val)); } } DBComparison compare = DBComparison.In(fld, items.ToArray()); DBFilterSet fs = DBFilterSet.Where(compare); this._where = fs; this._last = fs; return(this); }
/// <summary> /// Overrides the base implementation to read the From and Where elements /// </summary> /// <param name="reader"></param> /// <param name="context"></param> /// <returns></returns> protected override bool ReadAnInnerElement(System.Xml.XmlReader reader, XmlReaderContext context) { bool b; if (this.IsElementMatch(XmlHelper.From, reader, context) && !reader.IsEmptyElement && reader.Read()) { this._from = (DBTable)this.ReadNextInnerClause(XmlHelper.From, reader, context); reader.Read(); b = true; } else if (this.IsElementMatch(XmlHelper.Where, reader, context)) { this._where = (DBFilterSet)context.Factory.Read(XmlHelper.Where, reader, context); b = true; } else { b = base.ReadAnInnerElement(reader, context); } return(b); }
public static DBFilterSet Where() { DBFilterSet fs = new DBFilterSet(); return(fs); }
protected virtual DBClause DoRead(string element, XmlReader reader, XmlReaderContext context) { DBClause c = null; switch (element) { case (XmlHelper.Select): c = DBSelectQuery.Select(); break; case (XmlHelper.Delete): c = DBDeleteQuery.Delete(); break; case (XmlHelper.Update): c = DBUpdateQuery.Update(); break; case (XmlHelper.Insert): c = DBInsertQuery.InsertInto(); break; case (XmlHelper.Script): c = DBQuery.Script(); break; case (XmlHelper.Use): c = DBUseQuery.Use(); break; case (XmlHelper.Table): c = DBTable.Table(); break; case (XmlHelper.Fields): c = DBSelectSet.Select(); break; case (XmlHelper.AField): c = DBField.Field(); break; case (XmlHelper.AllFields): c = DBField.AllFields(); break; case (XmlHelper.From): c = DBTableSet.From(); break; case (XmlHelper.Where): c = DBFilterSet.Where(); break; case (XmlHelper.Group): c = DBGroupBySet.GroupBy(); break; case (XmlHelper.Order): c = DBOrderSet.OrderBy(); break; case (XmlHelper.Assignments): c = DBAssignSet.Assign(); break; case (XmlHelper.Values): c = DBValueSet.Values(); break; case (XmlHelper.Join): c = DBJoin.Join(); break; case (XmlHelper.Function): c = DBFunction.Function(); break; case (XmlHelper.Constant): c = DBConst.Null(); break; case (XmlHelper.Top): c = DBTop.Top(); break; case (XmlHelper.UnaryOp): c = DBComparison.Not(); break; case (XmlHelper.Compare): c = DBComparison.Compare(); break; case (XmlHelper.Between): c = DBComparison.Between(); break; case (XmlHelper.Parameter): //parameter is a special case. //we add them to akeyed colection if they are not already registered //then at the end we set the values at the end string name = reader.GetAttribute(XmlHelper.Name); DBParam aparam; if (context.Parameters.TryGetParameter(name, out aparam)) { c = aparam; } else { aparam = DBParam.Param(); aparam.Name = name; context.Parameters.Add(aparam); c = aparam; } break; case (XmlHelper.OrderBy): c = DBOrder.OrderBy(); break; case (XmlHelper.Calculation): c = DBCalc.Calculate(); break; case (XmlHelper.Aggregate): c = DBAggregate.Aggregate(); break; case (XmlHelper.ValueGroup): c = DBValueGroup.Empty(); break; case (XmlHelper.BooleanOperator): c = DBBooleanOp.Compare(); break; case (XmlHelper.Assign): c = DBAssign.Assign(); break; case (XmlHelper.InnerSelect): c = DBSubQuery.SubSelect(); break; case (XmlHelper.Multiple): c = DBMultiComparisonRef.Many(); break; case (XmlHelper.QueryOptionSet): c = new DBQueryHintOptionSet(); break; case (XmlHelper.QueryOption): c = DBQueryHintOption.QueryOption(); break; case (XmlHelper.CreateSproc): c = DBCreateProcedureQuery.CreateProcedure(); break; case (XmlHelper.Declare): c = DBDeclaration.Declare(); break; case (XmlHelper.CreateTable): c = DBCreateTableQuery.Table(); break; case (XmlHelper.ColumnDefinition): c = DBColumn.Column(); break; case (XmlHelper.PrimaryKey): c = DBPrimaryKey.PrimaryKey(); break; case (XmlHelper.ForeignKey): c = DBForeignKey.ForeignKey(); break; case (XmlHelper.CreateIndex): c = DBCreateIndexQuery.Index(); break; case (XmlHelper.CreateView): c = DBCreateViewQuery.CreateView(); break; case (XmlHelper.CreateSequence): c = DBCreateSequenceQuery.Sequence(); break; case (XmlHelper.DropTable): c = DBDropTableQuery.DropTable(); break; case (XmlHelper.DropIndex): c = DBDropIndexQuery.DropIndex(); break; case (XmlHelper.DropView): c = DBDropViewQuery.DropView(); break; case (XmlHelper.DropSproc): c = DBDropProcedureQuery.DropProcedure(); break; case (XmlHelper.DropSequence): c = DBDropSequenceQuery.DropSequence(); break; default: throw XmlHelper.CreateException("The XML data could not be deserialized because the element {1} was not recognised. {0}", reader, null, element); } if (c != null) { c.ReadXml(reader, context); } return(c); }