Skip to content

Commit 43fc985

Browse files
committed
Fixed the WHERE issue with the paging. Brought the change back from the PostGres version
1 parent 38df9bd commit 43fc985

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Massive.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public virtual IEnumerable<dynamic> All(string where = "", string orderBy = "",
305305
private static string BuildSelect(string where, string orderBy, int limit) {
306306
string sql = limit > 0 ? "SELECT TOP " + limit + " {0} FROM {1} " : "SELECT {0} FROM {1} ";
307307
if (!string.IsNullOrEmpty(where))
308-
sql += where.Trim().StartsWith("where", StringComparison.OrdinalIgnoreCase) ? where : "WHERE " + where;
308+
sql += where.Trim().StartsWith("where", StringComparison.OrdinalIgnoreCase) ? where : " WHERE " + where;
309309
if (!String.IsNullOrEmpty(orderBy))
310310
sql += orderBy.Trim().StartsWith("order by", StringComparison.OrdinalIgnoreCase) ? orderBy : " ORDER BY " + orderBy;
311311
return sql;
@@ -342,7 +342,7 @@ private dynamic BuildPagedResult(string sql = "", string primaryKeyField = "", s
342342
{
343343
if (!where.Trim().StartsWith("where", StringComparison.CurrentCultureIgnoreCase))
344344
{
345-
where = "WHERE " + where;
345+
where = " WHERE " + where;
346346
}
347347
}
348348

0 commit comments

Comments
 (0)