Inheritance: ICloneable
		/// <summary>
		///   Copies the elements of an array to the end of the <see cref='WhereTermCollection'/>.
		/// </summary>
		/// <param name='val'>
		///    An array of type <see cref='WhereTerm'/> containing the objects to add to the collection.
		/// </param>
		/// <seealso cref='WhereTermCollection.Add'/>
		public void AddRange(WhereTerm[] val)
		{
			for (int i = 0; i < val.Length; i++)
			{
				Add(val[i]);
			}
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Creates a WhereTerm which represents SQL IN clause
		/// </summary>
		/// <param name="expr">Expression to be looked up</param>
		/// <param name="sql">Sub query</param>
		/// <returns></returns>
		public static WhereTerm CreateIn(SqlExpression expr, string sql)
		{
			WhereTerm term = new WhereTerm();
			term.expr1 = expr;
			term.subQuery = sql;

			term.type = WhereTermType.InSubQuery;

			return term;
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Creates a comparison WhereTerm.
		/// </summary>
		/// <param name="expr1">Expression on the left side of the operator</param>
		/// <param name="expr2">Expression on the right side of the operator</param>
		/// <param name="op">Conditional operator to be applied on the expressions</param>
		/// <returns>A new conditional WhereTerm</returns>
		/// <remarks>
		/// A comparison term compares two expression on the basis of their values. Expressions can be of any type but their results must be of comparible types. 
		/// For instance, you can not compare a database field of type 'date' and a static value of type 'int'.
		/// </remarks>
		/// <example>
		/// <code>
		/// ...
		/// query.WherePhrase.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field("name", tCustomers), SqlExpression.String("J%"), CompareOperator.Like));
		/// </code>
		/// </example>
		public static WhereTerm CreateCompare(SqlExpression expr1, SqlExpression expr2, CompareOperator op)
		{
			WhereTerm term = new WhereTerm();
			term.expr1 = expr1;
			term.expr2 = expr2;
			term.op = op;

			term.type = WhereTermType.Compare;

			return term;
		}
		/// <summary>
		///    Returns the index of a <see cref='WhereTerm'/> in 
		///       the <see cref='WhereTermCollection'/>.
		/// </summary>
		/// <param name='val'>The <see cref='WhereTerm'/> to locate.</param>
		/// <returns>
		///   The index of the <see cref='WhereTerm'/> of <paramref name='val'/> in the 
		///   <see cref='WhereTermCollection'/>, if found; otherwise, -1.
		/// </returns>
		/// <seealso cref='WhereTermCollection.Contains'/>
		public int IndexOf(WhereTerm val)
		{
			return List.IndexOf(val);
		}
		/// <summary>
		///   Inserts a <see cref='WhereTerm'/> into the <see cref='WhereTermCollection'/> at the specified index.
		/// </summary>
		/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
		/// <param name='val'>The <see cref='WhereTerm'/> to insert.</param>
		/// <seealso cref='WhereTermCollection.Add'/>
		public void Insert(int index, WhereTerm val)
		{
			List.Insert(index, val);
		}
		/// <summary>
		///   Gets a value indicating whether the 
		///    <see cref='WhereTermCollection'/> contains the specified <see cref='WhereTerm'/>.
		/// </summary>
		/// <param name='val'>The <see cref='WhereTerm'/> to locate.</param>
		/// <returns>
		/// <see langword='true'/> if the <see cref='WhereTerm'/> is contained in the collection; 
		///   otherwise, <see langword='false'/>.
		/// </returns>
		/// <seealso cref='WhereTermCollection.IndexOf'/>
		public bool Contains(WhereTerm val)
		{
			return List.Contains(val);
		}
		/// <summary>
		///   Copies the <see cref='WhereTermCollection'/> values to a one-dimensional <see cref='Array'/> instance at the 
		///    specified index.
		/// </summary>
		/// <param name='array'>The one-dimensional <see cref='Array'/> that is the destination of the values copied from <see cref='WhereTermCollection'/>.</param>
		/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
		/// <exception cref='ArgumentException'>
		///   <para><paramref name='array'/> is multidimensional.</para>
		///   <para>-or-</para>
		///   <para>The number of elements in the <see cref='WhereTermCollection'/> is greater than
		///         the available space between <paramref name='arrayIndex'/> and the end of
		///         <paramref name='array'/>.</para>
		/// </exception>
		/// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
		/// <exception cref='ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
		/// <seealso cref='Array'/>
		public void CopyTo(WhereTerm[] array, int index)
		{
			List.CopyTo(array, index);
		}
Ejemplo n.º 8
0
 /// <summary>
 ///   Inserts a <see cref='WhereTerm'/> into the <see cref='WhereTermCollection'/> at the specified index.
 /// </summary>
 /// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
 /// <param name='val'>The <see cref='WhereTerm'/> to insert.</param>
 /// <seealso cref='WhereTermCollection.Add'/>
 public void Insert(int index, WhereTerm val)
 {
     List.Insert(index, val);
 }
Ejemplo n.º 9
0
		/// <summary>
		/// Creates a WhereTerm which represents SQL IN clause
		/// </summary>
		/// <param name="expr">Expression to be looked up</param>
		/// <param name="values">List of values</param>
		/// <returns></returns>
		public static WhereTerm CreateIn(SqlExpression expr, SqlConstantCollection values)
		{
			WhereTerm term = new WhereTerm();
			term.expr1 = expr;
			term.values = values;

			term.type = WhereTermType.In;

			return term;
		}
Ejemplo n.º 10
0
		/// <summary>
		/// Creates a copy of this WhereTerm
		/// </summary>
		/// <returns>A new WhereTerm which exactly the same as the current one.</returns>
		public WhereTerm Clone()
		{
			WhereTerm a = new WhereTerm();

			a.expr1 = expr1;
			a.expr2 = expr2;
			a.expr3 = expr3;
			a.op = op;
			a.type = type;
			a.subQuery = subQuery;
			a.values = new SqlConstantCollection(values);

			return a;
		}
		/// <summary>
		///   Adds a <see cref='WhereTerm'/> with the specified value to the 
		///   <see cref='WhereTermCollection'/>.
		/// </summary>
		/// <param name='val'>The <see cref='WhereTerm'/> to add.</param>
		/// <returns>The index at which the new element was inserted.</returns>
		/// <seealso cref='WhereTermCollection.AddRange'/>
		public int Add(WhereTerm val)
		{
			return List.Add(val);
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Creates a WhereTerm which encapsulates SQL NOT EXISTS clause
		/// </summary>
		/// <param name="sql">Sub query for the NOT EXISTS clause</param>
		/// <returns></returns>
		public static WhereTerm CreateNotExists(string sql)
		{
			WhereTerm term = new WhereTerm();
			term.subQuery = sql;
			term.type = WhereTermType.NotExists;
			return term;
		}
Ejemplo n.º 13
0
		/// <summary>
		/// Creates a WhereTerm which checks weather a value is in a specifed range.
		/// </summary>
		/// <param name="expr">Expression which yeilds the value to be checked</param>
		/// <param name="lowBound">Expression which yeilds the low bound of the range</param>
		/// <param name="highBound">Expression which yeilds the high bound of the range</param>
		/// <returns>A new WhereTerm</returns>
		/// <remarks>
		/// CreateBetween only accepts expressions which yeild a 'Date' or 'Number' values.
		/// All expressions must be of compatible types.
		/// </remarks>
		public static WhereTerm CreateBetween(SqlExpression expr, SqlExpression lowBound, SqlExpression highBound)
		{
			WhereTerm term = new WhereTerm();
			term.expr1 = expr;
			term.expr2 = lowBound;
			term.expr3 = highBound;

			term.type = WhereTermType.Between;

			return term;
		}
Ejemplo n.º 14
0
		/// <summary>
		/// Creates a WhereTerm which returns TRUE if an expression is NOT NULL
		/// </summary>
		/// <param name="expr"></param>
		/// <returns></returns>
		public static WhereTerm CreateIsNotNull(SqlExpression expr)
		{
			WhereTerm term = new WhereTerm();
			term.expr1 = expr;
			term.type = WhereTermType.IsNotNull;
			return term;
		}
Ejemplo n.º 15
0
 /// <summary>
 ///   Adds a <see cref='WhereTerm'/> with the specified value to the
 ///   <see cref='WhereTermCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='WhereTerm'/> to add.</param>
 /// <returns>The index at which the new element was inserted.</returns>
 /// <seealso cref='WhereTermCollection.AddRange'/>
 public int Add(WhereTerm val)
 {
     return(List.Add(val));
 }
Ejemplo n.º 16
0
 /// <summary>
 ///   Removes a specific <see cref='WhereTerm'/> from the <see cref='WhereTermCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='WhereTerm'/> to remove from the <see cref='WhereTermCollection'/>.</param>
 /// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
 public void Remove(WhereTerm val)
 {
     List.Remove(val);
 }
		/// <summary>
		///   Removes a specific <see cref='WhereTerm'/> from the <see cref='WhereTermCollection'/>.
		/// </summary>
		/// <param name='val'>The <see cref='WhereTerm'/> to remove from the <see cref='WhereTermCollection'/>.</param>
		/// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
		public void Remove(WhereTerm val)
		{
			List.Remove(val);
		}
Ejemplo n.º 18
0
 public void AddCompare(string column, SqlExpression expression, CompareOperator compareOperator)
 {
     WherePhrase.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field(column, fromClause.BaseTable),
                                                   expression, compareOperator));
 }
		/// <summary>
		///   Initializes a new instance of <see cref='WhereTermCollection'/> containing any array of <see cref='WhereTerm'/> objects.
		/// </summary>
		/// <param name='val'>
		///       A array of <see cref='WhereTerm'/> objects with which to intialize the collection
		/// </param>
		public WhereTermCollection(WhereTerm[] val)
		{
			AddRange(val);
		}
Ejemplo n.º 20
0
 /// <summary>
 ///   Gets a value indicating whether the
 ///    <see cref='WhereTermCollection'/> contains the specified <see cref='WhereTerm'/>.
 /// </summary>
 /// <param name='val'>The <see cref='WhereTerm'/> to locate.</param>
 /// <returns>
 /// <see langword='true'/> if the <see cref='WhereTerm'/> is contained in the collection;
 ///   otherwise, <see langword='false'/>.
 /// </returns>
 /// <seealso cref='WhereTermCollection.IndexOf'/>
 public bool Contains(WhereTerm val)
 {
     return(List.Contains(val));
 }
Ejemplo n.º 21
0
 public WhereTerm CreateCompare(Enum column, SqlExpression expression, CompareOperator compareOperator)
 {
     return(WhereTerm.CreateCompare(SqlExpression.Field(column, fromClause.BaseTable),
                                    expression, compareOperator));
 }
Ejemplo n.º 22
0
 /// <summary>
 ///    Returns the index of a <see cref='WhereTerm'/> in
 ///       the <see cref='WhereTermCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='WhereTerm'/> to locate.</param>
 /// <returns>
 ///   The index of the <see cref='WhereTerm'/> of <paramref name='val'/> in the
 ///   <see cref='WhereTermCollection'/>, if found; otherwise, -1.
 /// </returns>
 /// <seealso cref='WhereTermCollection.Contains'/>
 public int IndexOf(WhereTerm val)
 {
     return(List.IndexOf(val));
 }