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

com.github.chengyuxing.sql.page.impl.MysqlPageHelper Maven / Gradle / Ivy

Go to download

Light wrapper of JDBC, support ddl, dml, query, plsql/procedure/function, transaction and manage sql file.

There is a newer version: 9.0.2
Show newest version
package com.github.chengyuxing.sql.page.impl;

import com.github.chengyuxing.sql.Args;
import com.github.chengyuxing.sql.page.PageHelper;
import org.jetbrains.annotations.NotNull;

/**
 * 

Mysql/MariaDB page helper, * e.g.

*
*
select * from ... limit :{@link  #START_NUM_KEY}, :{@link #END_NUM_KEY};
*
* * @see #pagedArgs() */ public class MysqlPageHelper extends PageHelper { public int limit() { return (pageNumber - 1) * pageSize; } public int size() { if (recordCount == 0) { return 0; } return pageSize; } @Override public @NotNull String pagedSql(char namedParamPrefix, @NotNull String sql) { return sql + " limit " + namedParamPrefix + START_NUM_KEY + ", " + namedParamPrefix + END_NUM_KEY; } @Override public @NotNull Args pagedArgs() { return Args.of(START_NUM_KEY, limit()).add(END_NUM_KEY, size()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy