//---------------------------------------------------------------------
//
// Portions of this file copyright (c) Microsoft Corporation
// and are released under the Microsoft Pulic License. See
// http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
// or License.txt for details.
// All rights reserved.
//
//---------------------------------------------------------------------
#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
using System.Globalization;
///
/// SkipClause represents the a SKIP expression in a SqlSelectStatement.
/// It has a count property, which indicates how many rows should be skipped.
///
class SkipClause : ISqlFragment
{
ISqlFragment skipCount;
///
/// How many rows should be skipped.
///
internal ISqlFragment SkipCount
{
get { return skipCount; }
}
///
/// Creates a SkipClause with the given skipCount.
///
///
internal SkipClause(ISqlFragment skipCount)
{
this.skipCount = skipCount;
}
///
/// Creates a SkipClause with the given skipCount.
///
///
internal SkipClause(int skipCount)
{
SqlBuilder sqlBuilder = new SqlBuilder();
sqlBuilder.Append(skipCount.ToString(CultureInfo.InvariantCulture));
this.skipCount = sqlBuilder;
}
#region ISqlFragment Members
///
/// Write out the SKIP part of sql select statement
/// It basically writes OFFSET (X).
///
///
///
public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
{
writer.Write(" OFFSET ");
this.SkipCount.WriteSql(writer, sqlGenerator);
}
#endregion
}
}