本文整理了Java中net.sf.jsqlparser.statement.select.Limit
类的一些代码示例,展示了Limit
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Limit
类的具体详情如下:
包路径:net.sf.jsqlparser.statement.select.Limit
类名称:Limit
[英]A limit clause in the form [LIMIT {[offset,] row_count) | (row_count | ALL) OFFSET offset}]
[中]格式为[limit{[offset,]row_count)|(row_count | ALL)offset}]的limit子句
代码示例来源:origin: JSQLParser/JSqlParser
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));Limit limit = new Limit();
Token token = null;
JdbcParameter jdbc = null;
case S_LONG:{
token = jj_consume_token(S_LONG);
limit.setOffset(new LongValue(token.image));
break;
limit.setOffset(jdbc);
break;
limit.setOffset(new JdbcNamedParameter());
if (jj_2_45(2)) {
token = jj_consume_token(S_IDENTIFIER);
((JdbcNamedParameter)limit.getOffset()).setName(token.image);
} else {
case S_LONG:{
token = jj_consume_token(S_LONG);
limit.setRowCount(new LongValue(token.image));
break;
limit.setRowCount(jdbc);
break;
limit.setRowCount(new JdbcNamedParameter());
代码示例来源:origin: alibaba/mdrill
final public Limit Limit() throws ParseException {
Limit limit = new Limit();
Token token = null;
if (jj_2_8(3)) {
case S_INTEGER:
token = jj_consume_token(S_INTEGER);
limit.setOffset(Long.parseLong(token.image));
break;
case 83:
jj_consume_token(83);
limit.setOffsetJdbcParameter(true);
break;
default:
case S_INTEGER:
token = jj_consume_token(S_INTEGER);
limit.setRowCount(Long.parseLong(token.image));
break;
case 83:
jj_consume_token(83);
limit.setRowCountJdbcParameter(true);
break;
default:
case S_INTEGER:
token = jj_consume_token(S_INTEGER);
limit.setOffset(Long.parseLong(token.image));
break;
case 83:
代码示例来源:origin: alibaba/mdrill
public void deparseLimit(Limit limit) {
// LIMIT n OFFSET skip
buffer.append(" LIMIT ");
if (limit.isRowCountJdbcParameter()) {
buffer.append("?");
} else if (limit.getRowCount() != 0) {
buffer.append(limit.getRowCount());
} else {
/*
from mysql docs:
For compatibility with PostgreSQL, MySQL also supports the LIMIT row_count OFFSET offset syntax.
To retrieve all rows from a certain offset up to the end of the result set, you can use some large number
for the second parameter.
*/
buffer.append("18446744073709551615");
}
if (limit.isOffsetJdbcParameter()) {
buffer.append(" OFFSET ?");
} else if (limit.getOffset() != 0) {
buffer.append(" OFFSET " + limit.getOffset());
}
}
代码示例来源:origin: JSQLParser/JSqlParser
public void deParse(Limit limit) {
buffer.append(" LIMIT ");
if (limit.isLimitNull()) {
buffer.append("NULL");
} else {
if (null != limit.getOffset()) {
buffer.append(limit.getOffset()).append(", ");
}
if (null != limit.getRowCount()) {
buffer.append(limit.getRowCount());
}
}
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-sql-parser
final public Limit Limit() throws ParseException {Limit limit = new Limit();
Token token = null;
if (jj_2_8(3)) {
limit.setCommentLimit(token.specialToken.image);
token = jj_consume_token(S_INTEGER);
if (token.specialToken != null) {
limit.setCommentLimitValue(token.specialToken.image);
limit.setOffset(Long.parseLong(token.image));
break;
token = jj_consume_token(HOOK);
if (token.specialToken != null) {
limit.setCommentLimitValue(token.specialToken.image);
limit.setOffsetJdbcParameter(true);
break;
limit.setCommentComma(token.specialToken.image);
limit.setComma(true);
switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
case S_INTEGER:{
token = jj_consume_token(S_INTEGER);
if (token.specialToken != null) {
limit.setCommentAfterCommaValue(token.specialToken.image);
limit.setRowCount(Long.parseLong(token.image));
代码示例来源:origin: zhicwu/cassandra-jdbc-driver
Limit limit = plainSelect.getLimit();
if (limit == null) {
limit = new Limit();
limit.setRowCount(rowLimit);
plainSelect.setLimit(limit);
} else {
limit.setLimitAll(false);
limit.setOffsetJdbcParameter(false);
limit.setOffset(-1);
if (limit.getRowCount() <= 0) {
limit.setRowCount(rowLimit);
代码示例来源:origin: com.eas.platypus/platypus-js-sql-parser
.append(limit.getCommentLimit() != null ? " " + limit.getCommentLimit() + ExpressionDeParser.LINE_SEPARATOR : "").append(" Limit");
if (limit.isLimitAll()) {
buffer.append(limit.getCommentAll() != null ? " " + limit.getCommentAll() + ExpressionDeParser.LINE_SEPARATOR : "").append(" All ");
buffer.append(limit.getCommentLimitValue() != null ? limit.getCommentLimitValue() + " " + ExpressionDeParser.LINE_SEPARATOR : "");
if (limit.isComma()) {
if (limit.isOffsetJdbcParameter()) {
buffer.append("?");
} else if (limit.getOffset() != 0) {
buffer.append(limit.getOffset());
buffer.append(limit.getCommentComma() != null ? limit.getCommentComma() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(", ")
.append(limit.getCommentAfterCommaValue() != null ? limit.getCommentAfterCommaValue() + " " + ExpressionDeParser.LINE_SEPARATOR : "");
if (limit.isRowCountJdbcParameter()) {
buffer.append("?");
} else if (limit.getRowCount() != 0) {
buffer.append(limit.getRowCount());
if (limit.isRowCountJdbcParameter()) {
buffer.append("?");
} else {
if (limit.getRowCount() != 0) {
buffer.append(limit.getRowCount());
} else {
if (limit.isOffsetJdbcParameter()) {
buffer.append(limit.getCommentOffset() != null ? " " + limit.getCommentOffset() + ExpressionDeParser.LINE_SEPARATOR : "").append(" Offset")
.append(limit.getCommentOffsetValue() != null ? " " + limit.getCommentOffsetValue() + ExpressionDeParser.LINE_SEPARATOR : "").append(" ?");
代码示例来源:origin: JSQLParser/JSqlParser
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));Limit limit = new Limit();
Token token = null;
JdbcParameter jdbc;
case S_LONG:{
token = jj_consume_token(S_LONG);
limit.setRowCount(new LongValue(token.image));
break;
limit.setRowCount(jdbc);
break;
limit.setRowCount(new JdbcNamedParameter());
if (jj_2_48(2)) {
token = jj_consume_token(S_IDENTIFIER);
((JdbcNamedParameter)limit.getRowCount()).setName(token.image);
} else {
limit.setLimitAll(true);
break;
limit.setLimitNull(true);
break;
代码示例来源:origin: io.github.itfinally/mybatis-paging
private MySqlHook( String originSql, long beginRow, long range ) throws JSQLParserException {
final Limit limit = new Limit();
limit.setRowCount( new LongValue( range ) );
limit.setOffset( new LongValue( beginRow ) );
代码示例来源:origin: metatron-app/metatron-discovery
public PlainSelect addLimit(PlainSelect selectBody, int maxLimit) {
Limit limitExpression = new Limit();
limitExpression.setRowCount(new LongValue(maxLimit));
selectBody.setLimit(limitExpression);
return selectBody;
}
代码示例来源:origin: vincentrussell/sql-to-mongo-db-query-converter
public static long getLimit(Limit limit) throws ParseException {
if (limit!=null) {
String rowCountString = SqlUtils.getStringValue(limit.getRowCount());
BigInteger bigInt = new BigInteger(rowCountString);
isFalse(bigInt.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) > 0, rowCountString + ": value is too large");
return bigInt.longValue();
}
return -1;
}
代码示例来源:origin: Quetzal-RDF/quetzal
if (ps.getLimit()!=null && ps.getLimit().getRowCount() == 0 && ps.getLimit().toString().equals("")) {
ret += " LIMIT 0";
代码示例来源:origin: com.github.jsqlparser/jsqlparser
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));Limit limit = new Limit();
Token token = null;
JdbcParameter jdbc;
case S_LONG:{
token = jj_consume_token(S_LONG);
limit.setRowCount(new LongValue(token.image));
break;
limit.setRowCount(jdbc);
break;
limit.setRowCount(new JdbcNamedParameter());
if (jj_2_47(2)) {
token = jj_consume_token(S_IDENTIFIER);
((JdbcNamedParameter)limit.getRowCount()).setName(token.image);
} else {
limit.setLimitAll(true);
break;
limit.setLimitNull(true);
break;
代码示例来源:origin: org.opencadc/cadc-adql
if (limit != null)
limit.setRowCount(rowCount);
limit = new Limit();
limit.setRowCount(rowCount);
plainSelect.setLimit(limit);
代码示例来源:origin: com.github.jsqlparser/jsqlparser
public void deParse(Limit limit) {
buffer.append(" LIMIT ");
if (limit.isLimitNull()) {
buffer.append("NULL");
} else {
if (null != limit.getOffset()) {
buffer.append(limit.getOffset()).append(", ");
}
if (null != limit.getRowCount()) {
buffer.append(limit.getRowCount());
}
}
}
}
代码示例来源:origin: org.opencadc/cadc-adql
/**
* Incorrectly handles limit of 0 by setting the limit to BigInt.MAX when
* the limit is 0 so hard code LIMIT 0.
*
* @param limit
*/
@Override
public void deparseLimit(Limit limit)
{
log.debug("visit(" + limit.getClass().getSimpleName() + ") " + limit);
if (limit.getRowCount() == 0)
{
buffer.append(" LIMIT 0");
}
else
{
super.deparseLimit(limit);
}
}
代码示例来源:origin: diennea/herddb
private void visitLimit(Limit limit) {
if (limit.getOffset() != null) {
if (limit.getOffset() instanceof JdbcParameter) {
limit.setOffset(ImmutableExpressionsCache.internOrFixJdbcParameterExpression((JdbcParameter) limit.getOffset()));
}
limit.getOffset().accept(this);
}
if (limit.getRowCount() != null) {
if (limit.getRowCount() instanceof JdbcParameter) {
limit.setRowCount(ImmutableExpressionsCache.internOrFixJdbcParameterExpression((JdbcParameter) limit.getRowCount()));
}
limit.getRowCount().accept(this);
}
}
代码示例来源:origin: org.opencadc/cadc-jsqlparser-compat
final public Limit Limit() throws ParseException {Limit limit = new Limit();
Token token = null;
if (jj_2_8(3)) {
case S_INTEGER:{
token = jj_consume_token(S_INTEGER);
limit.setOffset(Long.parseLong(token.image));
break;
limit.setOffsetJdbcParameter(true);
break;
case S_INTEGER:{
token = jj_consume_token(S_INTEGER);
limit.setRowCount(Long.parseLong(token.image));
break;
limit.setRowCountJdbcParameter(true);
break;
case S_INTEGER:{
token = jj_consume_token(S_INTEGER);
limit.setOffset(Long.parseLong(token.image));
break;
limit.setOffsetJdbcParameter(true);
break;
case S_INTEGER:{
token = jj_consume_token(S_INTEGER);
代码示例来源:origin: org.opencadc/cadc-adql
public PgLimit(Limit limit)
{
this.offset = limit.getOffset();
this.rowCount = limit.getRowCount();
this.rowCountJdbcParameter = limit.isRowCountJdbcParameter();
this.offsetJdbcParameter = limit.isOffsetJdbcParameter();
this.limitAll = limit.isLimitAll();
}
代码示例来源:origin: com.github.jsqlparser/jsqlparser
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));Limit limit = new Limit();
Token token = null;
JdbcParameter jdbc = null;
case S_LONG:{
token = jj_consume_token(S_LONG);
limit.setOffset(new LongValue(token.image));
break;
limit.setOffset(jdbc);
break;
limit.setOffset(new JdbcNamedParameter());
if (jj_2_44(2)) {
token = jj_consume_token(S_IDENTIFIER);
((JdbcNamedParameter)limit.getOffset()).setName(token.image);
} else {
case S_LONG:{
token = jj_consume_token(S_LONG);
limit.setRowCount(new LongValue(token.image));
break;
limit.setRowCount(jdbc);
break;
limit.setRowCount(new JdbcNamedParameter());
内容来源于网络,如有侵权,请联系作者删除!