org.hibernate.dialect.SQLiteLimitHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sqlite-dialect Show documentation
Show all versions of sqlite-dialect Show documentation
SQLite dialect for hibernate 5
The newest version!
package org.hibernate.dialect;
import org.hibernate.dialect.pagination.LimitHandler;
import org.hibernate.engine.spi.RowSelection;
import org.hibernate.dialect.pagination.LimitHelper;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* Limit handler for the SQLite dialect.
*/
public class SQLiteLimitHandler implements LimitHandler {
@Override
public boolean supportsLimit() {
return true;
}
@Override
public boolean supportsLimitOffset() {
return true;
}
@Override
public String processSql(String sql, RowSelection selection) {
if (LimitHelper.hasFirstRow(selection)) {
return sql + " limit ? offset ?";
} else {
return sql + " limit ?";
}
}
@Override
public int bindLimitParametersAtStartOfQuery(RowSelection selection, PreparedStatement statement, int index) throws SQLException {
return 0;
}
@Override
public int bindLimitParametersAtEndOfQuery(RowSelection selection, PreparedStatement statement, int index) throws SQLException {
return 0;
}
@Override
public void setMaxRows(RowSelection selection, PreparedStatement statement) throws SQLException {
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy