forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMsSqlCe40Dialect.cs
41 lines (35 loc) · 878 Bytes
/
MsSqlCe40Dialect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using NHibernate.SqlCommand;
namespace NHibernate.Dialect
{
public class MsSqlCe40Dialect : MsSqlCeDialect
{
public override bool SupportsLimitOffset
{
get { return true; }
}
public override bool SupportsVariableLimit
{
get { return true; }
}
public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
{
//TODO: Share code with MsSql2012Dialect.GetLimitString
var builder = new SqlStringBuilder(queryString);
if (queryString.IndexOfCaseInsensitive(" ORDER BY ") < 0)
builder.Add(" ORDER BY GETDATE()");
builder.Add(" OFFSET ");
if (offset == null)
builder.Add("0");
else
builder.Add(offset);
builder.Add(" ROWS");
if (limit != null)
{
builder.Add(" FETCH NEXT ");
builder.Add(limit);
builder.Add(" ROWS ONLY");
}
return builder.ToSqlString();
}
}
}