private void AddSubOperator(tgQuerySubOperator subOperator) { if (this.SubOperators == null) { this.SubOperators = new List<tgQuerySubOperator>(); } this.SubOperators.Add(subOperator); }
/// <summary> /// Aggregate StdDev. /// See <see cref="tgQuerySubOperatorType"/> Enumeration. /// </summary> /// <example> /// Aggregate StdDev with the column name as the default Alias. /// <code> /// emps.Query.Select(emps.Query.Age.StdDev()); /// </code> /// </example> /// <returns>The esAggregateItem returned to DynamicQuery.</returns> public tgQueryItem StdDev() { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.StdDev; this.AddSubOperator(subOp); return this; }
/// <summary> /// Aggregate Count. /// See <see cref="tgQuerySubOperatorType"/> Enumeration. /// </summary> /// <example> /// Aggregate Count with the column name as the default Alias. /// <code> /// emps.Query.Select(emps.Query.Age.Count()); /// </code> /// </example> /// <returns>The esAggregateItem returned to DynamicQuery.</returns> public tgQueryItem Count() { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.Count; this.AddSubOperator(subOp); return this; }
/// <summary> /// Returns a particular date part of a date column /// </summary> /// <param name="datePart"></param> public tgQueryItem DatePart(string datePart) { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.DatePart; subOp.Parameters["DatePart"] = datePart; this.AddSubOperator(subOp); return this; }
/// <summary> /// Aggregate Min. /// See <see cref="tgQuerySubOperatorType"/> Enumeration. /// </summary> /// <example> /// Aggregate Min with the column name as the default Alias. /// <code> /// emps.Query.Select(emps.Query.Age.Min()); /// </code> /// </example> /// <returns>The esAggregateItem returned to DynamicQuery.</returns> public tgQueryItem Min() { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.Min; this.AddSubOperator(subOp); return this; }
/// <summary> /// Returns the length of a character based column /// </summary> public tgQueryItem Length() { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.Length; this.AddSubOperator(subOp); return this; }
/// <summary> /// Performs a round on the column /// </summary> /// <param name="significantDigits">Round to the number of significant digits</param> public tgQueryItem Round(int significantDigits) { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.Round; subOp.Parameters["SignificantDigits"] = significantDigits; this.AddSubOperator(subOp); return this; }
/// <summary> /// Returns a portion of the string column /// </summary> /// <param name="length">How many characters to return</param> public tgQueryItem Substring(int length) { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.SubString; subOp.Parameters["length"] = length; this.AddSubOperator(subOp); return this; }
/// <summary> /// This can be used to return the first non null parameter. /// </summary> /// <remarks> /// The code below will return "Smith" is the LastName column in the database is null. /// <code> /// MyCollection coll = new MyCollection(); /// coll.Query.Select(coll.Query.LastName.Coalesce("'Smith'")); /// coll.Query.Load(); /// </code> /// </remarks> /// <param name="expresssions">The value to return if null</param> public tgQueryItem Coalesce(string expresssions) { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.Coalesce; subOp.Parameters["expressions"] = expresssions; this.AddSubOperator(subOp); return this; }
/// <summary> /// Returns a portion of the string column /// </summary> /// <param name="start">The starting character</param> /// <param name="length">How many characters to return</param> public tgQueryItem Substring(System.Int64 start, System.Int64 length) { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.SubString; subOp.Parameters["start"] = start; subOp.Parameters["length"] = length; this.AddSubOperator(subOp); return this; }
/// <summary> /// Performs a Right Trim (remove blanks) on the column /// </summary> public tgQueryItem RTrim() { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.RTrim; this.AddSubOperator(subOp); return this; }
/// <summary> /// Returns the column in LOWER CASE /// </summary> public tgQueryItem ToLower() { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.ToLower; this.AddSubOperator(subOp); return this; }
/// <summary> /// Cast informs the DataProviders that a SQL CAST operation is needed. This overloaded version /// of Cast is useful for Casting decimal types /// </summary> /// <remarks> /// In C# you can cast with the overloaded cast operators, like this: (tgString)query.Age /// </remarks> /// <param name="castType">The type of cast needed</param> /// <returns>The very same tgQueryItem now with Cast instructions</returns> public tgQueryItem Cast(tgCastType castType, int precision, int scale) { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.Cast; subOp.Parameters["tgCastType"] = castType; subOp.Parameters["precision"] = precision; subOp.Parameters["scale"] = scale; this.AddSubOperator(subOp); return this; }
/// <summary> /// Cast informs the DataProviders that a SQL CAST operation is needed. This overloaded version /// of Cast is useful for Casting variable length character columns /// </summary> /// <remarks> /// In C# you can cast with the overloaded cast operators, like this: (tgString)query.Age /// </remarks> /// <param name="castType">The type of cast needed</param> /// <returns>The very same tgQueryItem now with Cast instructions</returns> public tgQueryItem Cast(tgCastType castType, int length) { tgQuerySubOperator subOp = new tgQuerySubOperator(); subOp.SubOperator = tgQuerySubOperatorType.Cast; subOp.Parameters["tgCastType"] = castType; subOp.Parameters["length"] = length; this.AddSubOperator(subOp); return this; }