[#4659] Significant overhead caused by type lookup when using DSL.val(T) or DSL.inline(T) in org.jooq.impl.Limit
This commit is contained in:
parent
c421781e75
commit
00d64aa43a
@ -52,9 +52,9 @@ import static org.jooq.conf.ParamType.INLINED;
|
||||
import static org.jooq.conf.SettingsTools.executePreparedStatements;
|
||||
import static org.jooq.conf.SettingsTools.getParamType;
|
||||
import static org.jooq.impl.DSL.using;
|
||||
import static org.jooq.impl.Utils.consumeExceptions;
|
||||
import static org.jooq.impl.Utils.DataKey.DATA_COUNT_BIND_VALUES;
|
||||
import static org.jooq.impl.Utils.DataKey.DATA_FORCE_STATIC_STATEMENT;
|
||||
import static org.jooq.impl.Utils.consumeExceptions;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -483,13 +483,13 @@ abstract class AbstractQuery extends AbstractQueryPart implements Query, Attacha
|
||||
x
|
||||
x
|
||||
|
||||
xx xx xxxxxxxxxxxxxxxxxxxxxx x xxxxxxxx x
|
||||
xx xxxxx xxx xxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxx x xxxxxxx xxxxxxx xxxx xxx xxxx xxxxx xxxxxxxx xxxxxx xxxxxxxx xxxxxxxxx xx x xxxxxxxxxx xxxxxxx xx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxx xx xxx xxxx xxxxxxx xxxx xxxx xxxx xxxxxxxxx
|
||||
xx x
|
||||
xx
|
||||
xx xx xxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxx x
|
||||
xx xxxxx xxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxxx xxxxxx xxx xxxxx xxxx xxxx xxxx xxxxxx xxxxxxxx xxxxxxxxx xx x xxxxxxxxxx xxxxxxx xx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxx xx xxxxxx xxxx xxxx xxxxxxxxx
|
||||
xx x
|
||||
xx xxxxxxxxxxxxxxxxxxxxxx x xxxxxxxx x
|
||||
xxxxx xxx xxxxxxxxxxxxxxxxxxxxx xxxx xxxxxxxx x xxxxxxx xxxxxxx xxxx xxx xxxx xxxxx xxxxxxxx xxxxxx xxxxxxxx xxxxxxxxx xx x xxxxxxxxxx xxxxxxx xx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxx xx xxx xxxx xxxxxxx xxxx xxxx xxxx xxxxxxxxx
|
||||
x
|
||||
|
||||
xx xxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxx x
|
||||
xxxxx xxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxxx xxxxxx xxx xxxxx xxxx xxxx xxxx xxxxxx xxxxxxxx xxxxxxxxx xx x xxxxxxxxxx xxxxxxx xx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xx xxx xxxx xx xxxxxx xxxx xxxx xxxxxxxxx
|
||||
x
|
||||
|
||||
xx xxxxxxxx xx xx [/pro] */
|
||||
return result;
|
||||
|
||||
@ -43,7 +43,9 @@ package org.jooq.impl;
|
||||
import static org.jooq.RenderContext.CastMode.NEVER;
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
import static org.jooq.impl.DSL.inline;
|
||||
import static org.jooq.impl.DSL.one;
|
||||
import static org.jooq.impl.DSL.val;
|
||||
import static org.jooq.impl.DSL.zero;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Context;
|
||||
@ -61,13 +63,15 @@ class Limit extends AbstractQueryPart {
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 2053741242981425602L;
|
||||
private static final long serialVersionUID = 2053741242981425602L;
|
||||
private static final Field<Integer> ZERO = zero();
|
||||
private static final Field<Integer> ONE = one();
|
||||
|
||||
private Field<Integer> numberOfRows;
|
||||
private Field<Integer> offset;
|
||||
private Field<Integer> offsetOrZero = inline(0);
|
||||
private Field<Integer> offsetPlusOne = inline(1);
|
||||
private boolean rendersParams;
|
||||
private Field<Integer> numberOfRows;
|
||||
private Field<Integer> offset;
|
||||
private Field<Integer> offsetOrZero = ZERO;
|
||||
private Field<Integer> offsetPlusOne = ONE;
|
||||
private boolean rendersParams;
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> context) {
|
||||
@ -147,7 +151,7 @@ class Limit extends AbstractQueryPart {
|
||||
context.castMode(NEVER)
|
||||
.formatSeparator()
|
||||
.keyword("rows")
|
||||
.sql(' ').visit(getLowerRownum().add(inline(1)))
|
||||
.sql(' ').visit(getLowerRownum().add(inline(1, SQLDataType.INTEGER)))
|
||||
.sql(' ').keyword("to")
|
||||
.sql(' ').visit(getUpperRownum())
|
||||
.castMode(castMode);
|
||||
@ -330,9 +334,9 @@ class Limit extends AbstractQueryPart {
|
||||
|
||||
final void setOffset(int offset) {
|
||||
if (offset != 0) {
|
||||
this.offset = val(offset);
|
||||
this.offset = val(offset, SQLDataType.INTEGER);
|
||||
this.offsetOrZero = this.offset;
|
||||
this.offsetPlusOne = val(offset + 1);
|
||||
this.offsetPlusOne = val(offset + 1, SQLDataType.INTEGER);
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,7 +347,7 @@ class Limit extends AbstractQueryPart {
|
||||
}
|
||||
|
||||
final void setNumberOfRows(int numberOfRows) {
|
||||
this.numberOfRows = val(numberOfRows);
|
||||
this.numberOfRows = val(numberOfRows, SQLDataType.INTEGER);
|
||||
}
|
||||
|
||||
final void setNumberOfRows(Param<Integer> numberOfRows) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user