All Downloads are FREE. Search and download functionalities are using the official Maven repository.

panda.dao.sql.expert.Mssql2012SqlExpert Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
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);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy