public void Top_Not_Supported() { engine.Options.TopSupported = false; ITop top = sql.Top(10); Exception ex = Assert.Throws <ClauseNotSupportedException>(() => engine.Compile(top)); Assert.Equal("Top clause is not supported in this engine.", ex.Message); }
public void Top_Without_Parameters() { engine.Options.TopAsParameters = false; ITop top = sql.Top(10); QueryResult result = engine.Compile(top); Assert.Equal("TOP(10)", result.Sql); Assert.Equal(new Dictionary <string, object>(), result.Parameters); }
/// <summary> /// Specifies that only the first row will be returned from the query result. /// </summary> /// <param name="prev">A predecessor object.</param> public static TopChainer TopOne(this ITop prev) { if (prev is ISemantic) { return(new TopChainer((ISemantic)prev, 1, false)); } else { return(new TopChainer((Chainer)prev, 1, false)); } }
/// <summary> /// Specifies that all the rows with the same value in the ORDER BY columns appearing as the last of the TOP n (PERCENT) rows will be returned from the query result. /// </summary> /// <param name="prev">A predecessor object.</param> /// <param name="rows">Is the numeric float expression that specifies the percent of rows from the result set.</param> public static TopChainer TopWithTies(this ITop prev, double rows) { if (prev is ISemantic) { return(new TopChainer((ISemantic)prev, rows, true)); } else { return(new TopChainer((Chainer)prev, rows, true)); } }
/// <summary> /// Specifies that only the first set of rows will be returned from the query result. /// </summary> /// <param name="prev">A predecessor object.</param> /// <param name="rows">Is the numeric bigint expression that specifies the number of rows to be returned.</param> public static TopChainer Top(this ITop prev, long rows) { if (prev is ISemantic) { return(new TopChainer((ISemantic)prev, rows, false)); } else { return(new TopChainer((Chainer)prev, rows, false)); } }
internal static TopChainer Top(this ITop prev, Nullable <long> top, int overloader) { if (prev is ISemantic) { return(new TopChainer((ISemantic)prev, top, false, 0)); } else { return(new TopChainer((Chainer)prev, top, false, true)); } }
public void Top_Percent_With_Ties() { ITop top = sql.Top(10).Percent().WithTies(); QueryResult result = engine.Compile(top); Assert.Equal("TOP(@p0) PERCENT WITH TIES", result.Sql); Assert.Equal(new Dictionary <string, object> { ["@p0"] = 10 }, result.Parameters); }
public void Top() { ITop top = sql.Top(10); QueryResult result = engine.Compile(top); Assert.Equal("TOP(@p0)", result.Sql); Assert.Equal(new Dictionary <string, object> { ["@p0"] = 10 }, result.Parameters); }
/// <summary> /// Adds top to pizza /// </summary> /// <param name="newTop"></param> public void AddTop(ITop newTop) { if (newTop == null) { throw new ArgumentException($"{nameof(newTop)} is null"); } _tops.Add(newTop); _totalCookTime = _baseCookTime; _totalPrice = _price; foreach (var top in _tops) { _totalCookTime += top.GetCookTime(); _price += top.GetPrice(); } _totalCookTime = (int)(_totalCookTime * _cookingTimeMultiplier); }
/// <summary> /// Adds a "top" clause. /// </summary> /// <param name="top">The "top" clause.</param> /// <returns>The "update" statement.</returns> public virtual IUpdate Top(ITop top) { TopValue = top; return(this); }
public void To_String() { ITop top = sql.Top(10).Percent().WithTies(); Assert.Equal("TOP(10) PERCENT WITH TIES", top.ToString()); }
/// <summary> /// Specifies that all the rows with the same value in the ORDER BY columns appearing as the last of the TOP n (PERCENT) rows will be returned from the query result, where the numeric expression is passed as variable. /// </summary> /// <param name="prev">A predecessor object.</param> /// <param name="variable">Is the name of the variable of the TOP value.</param> public static TopChainer TopWithTies(this ITop prev, string variable) { return(new TopChainer((Chainer)prev, variable, true)); }
/// <summary> /// Specifies that only the first set of rows will be returned from the query result where the numeric expression is passed as variable. /// </summary> /// <param name="prev">A predecessor object.</param> /// <param name="variable">Is the name of the variabler of the TOP value.</param> public static TopChainer Top(this ITop prev, string variable) { return(new TopChainer((Chainer)prev, variable, false)); }