topOrLimit static method
Returns the appropriate "TOP" or "LIMIT" clause based on the given database provider and count.
If count
is not null, it returns "TOP(count)" for SQL Server and "LIMIT count" for MySQL.
Otherwise, it returns an empty string.
Implementation
static String topOrLimit(String dataBaseProvider, int? count) {
if (count != null && count > 0) {
if (isSqlServer(dataBaseProvider)) {
return "TOP($count)";
}
if (isMySql(dataBaseProvider)) {
return "LIMIT $count";
}
}
return "";
}