Esempio n. 1
0
		/// <summary>
		/// Performs dialect-specific manipulations on the limit value before returning it.
		/// This method is applicable for use in limit statements only.
		/// </summary>
		internal static int? GetLimitUsingDialect(RowSelection selection, Dialect.Dialect dialect)
		{
			if (selection == null || selection.MaxRows == RowSelection.NoValue)
				return null;
			return dialect.GetLimitValue(GetFirstRow(selection), selection.MaxRows);
		}
Esempio n. 2
0
		/// <summary> 
		/// Some dialect-specific LIMIT clauses require the maximium last row number
		/// (aka, first_row_number + total_row_count), while others require the maximum
		/// returned row count (the total maximum number of rows to return). 
		/// </summary>
		/// <param name="selection">The selection criteria </param>
		/// <param name="dialect">The dialect </param>
		/// <returns> The appropriate value to bind into the limit clause. </returns>
		internal static int GetMaxOrLimit(Dialect.Dialect dialect, RowSelection selection)
		{
			int firstRow = GetFirstRow(selection);
			int rowCount = selection.MaxRows;

			if (rowCount == RowSelection.NoValue)
				return int.MaxValue;

			return dialect.GetLimitValue(firstRow, rowCount);
		}
		protected object GetPagingValue(object value, Dialect.Dialect dialect, QueryParameters queryParameters)
		{
			if (isTakeParameter)
			{
				int skipParameterValue = 0;

				if (skipParameter != null)
					skipParameterValue = skipParameter.GetSkipValue(queryParameters);

				return dialect.GetLimitValue(skipParameterValue , (int)value);
			}

			if (isSkipParameter)
				return dialect.GetOffsetValue((int)value);

			return value;
		}