Sqlite uses TOP instead of LIMIT in the BuildSelect method #77

Closed
mattmc3 opened this Issue Aug 14, 2011 · 1 comment

2 participants

@mattmc3

The BuildSelect method in Massive.Sqlite needs changed to use the LIMIT keyword instead of the TOP syntax. Here's the fix:

private static string BuildSelect(string where, string orderBy, int limit) {
string sql = "SELECT {0} FROM {1} ";
if (!string.IsNullOrEmpty(where))
sql += where.Trim().StartsWith("where", StringComparison.CurrentCultureIgnoreCase) ? where : "WHERE " + where;
if (!String.IsNullOrEmpty(orderBy))
sql += orderBy.Trim().StartsWith("order by", StringComparison.CurrentCultureIgnoreCase) ? orderBy : " ORDER BY " + orderBy;
if (limit > 0)
sql += " LIMIT " + limit.ToString();
return sql;
}

@robconery
Collaborator

Pull request please.

@robconery robconery closed this Sep 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment