throws TorqueException
{
int limit = criteria.getLimit();
int offset = criteria.getOffset();
DB db = Torque.getDB(criteria.getDbName());
if (offset > 0 || limit > 0)
{
// If we hit a database type, that is able to do native
// limiting, we must set the criteria values to -1 and 0
// afterwards. Reason is, that else theexecuteQuery
// method tries to do the limiting using Village
//
switch (db.getLimitStyle())
{
case DB.LIMIT_STYLE_MYSQL :
LimitHelper.generateMySQLLimits(query, offset, limit);
break;
case DB.LIMIT_STYLE_POSTGRES :
LimitHelper.generatePostgreSQLLimits(query, offset, limit);
break;
case DB.LIMIT_STYLE_ORACLE :
LimitHelper.generateOracleLimits(query, offset, limit);
break;
case DB.LIMIT_STYLE_DB2 :
LimitHelper.generateDB2Limits(query, offset, limit);
break;
default:
if (db.supportsNativeLimit())
{
query.setLimit(String.valueOf(limit));
}
break;
}