com.github.miemiedev.mybatis.paginator.dialect.H2Dialect Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-paginator Show documentation
Show all versions of mybatis-paginator Show documentation
A Mybatis plugin, implementation of database paging and sorting
The newest version!
package com.github.miemiedev.mybatis.paginator.dialect;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.ibatis.mapping.MappedStatement;
/**
* A dialect compatible with the H2 database.
*
* @author Thomas Mueller
* @author miemiedev
*/
public class H2Dialect extends Dialect {
public H2Dialect(MappedStatement mappedStatement, Object parameterObject, PageBounds pageBounds) {
super(mappedStatement, parameterObject, pageBounds);
}
protected String getLimitString(String sql, String offsetName,int offset, String limitName, int limit) {
return new StringBuffer(sql.length() + 40).
append(sql).
append((offset > 0) ? " limit "+String.valueOf(limit)+" offset "+String.valueOf(offset) : " limit "+String.valueOf(limit)).
toString();
}
}