提交 c57fb7c9 authored 作者: Andrei Tokar's avatar Andrei Tokar

miniscule optimisation

上级 b03f027c
......@@ -593,28 +593,23 @@ public class Select extends Query {
limitRows += offset;
}
}
ArrayList<Row> forUpdateRows = null;
boolean lockRows = this.isForUpdateMvcc;
if (lockRows) {
forUpdateRows = Utils.newSmallArrayList();
}
ArrayList<Row> forUpdateRows = this.isForUpdateMvcc ? Utils.<Row>newSmallArrayList() : null;
int sampleSize = getSampleSizeValue(session);
LazyResultQueryFlat lazyResult = new LazyResultQueryFlat(expressionArray,
sampleSize, columnCount);
if (result == null) {
return lazyResult;
}
while (lazyResult.next()) {
if (lockRows) {
if (sort != null && !sortUsingIndex || limitRows <= 0) {
limitRows = Long.MAX_VALUE;
}
while (result.getRowCount() < limitRows && lazyResult.next()) {
if (forUpdateRows != null) {
topTableFilter.lockRowAdd(forUpdateRows);
}
result.addRow(lazyResult.currentRow());
if ((sort == null || sortUsingIndex) && limitRows > 0 &&
result.getRowCount() >= limitRows) {
break;
}
}
if (lockRows) {
if (forUpdateRows != null) {
topTableFilter.lockRows(forUpdateRows);
}
return null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论