panda.dao.sql.expert.Mssql2012SqlExpert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of panda-core Show documentation
Show all versions of panda-core Show documentation
Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.
package panda.dao.sql.expert;
import panda.dao.query.Query;
import panda.dao.sql.Sql;
public class Mssql2012SqlExpert extends Mssql2005SqlExpert {
/**
* @param sql sql
* @param query query
*/
@Override
protected void limit(Sql sql, Query> query, String alias) {
if (query.hasOrders()) {
// offset needs order
// @see http://technet.microsoft.com/en-us/library/gg699618.aspx
sql.append(" OFFSET ").append(query.getStart()).append(" ROWS");
if (query.getLimit() > 0) {
sql.append(" FETCH NEXT ").append(query.getLimit()).append(" ROWS ONLY");
}
}
else {
super.limit(sql, query, alias);
}
}
}