source.parser优化
This commit is contained in:
@@ -2629,16 +2629,17 @@ public class DataJdbcSource extends AbstractDataSqlSource {
|
|||||||
}
|
}
|
||||||
long total = -1;
|
long total = -1;
|
||||||
List<V> list;
|
List<V> list;
|
||||||
|
final String countSql = sinfo.getNativeCountSql();
|
||||||
if (sinfo.isEmptyNamed()) {
|
if (sinfo.isEmptyNamed()) {
|
||||||
Statement stmt = conn.createQueryStatement();
|
Statement stmt = conn.createQueryStatement();
|
||||||
ResultSet set = stmt.executeQuery(sinfo.getNativeCountSql());
|
ResultSet set = stmt.executeQuery(countSql);
|
||||||
if (set.next()) {
|
if (set.next()) {
|
||||||
total = set.getLong(1);
|
total = set.getLong(1);
|
||||||
}
|
}
|
||||||
set.close();
|
set.close();
|
||||||
conn.offerQueryStatement(stmt);
|
conn.offerQueryStatement(stmt);
|
||||||
} else {
|
} else {
|
||||||
final PreparedStatement prestmt = conn.prepareQueryStatement(sinfo.getNativeCountSql());
|
final PreparedStatement prestmt = conn.prepareQueryStatement(countSql);
|
||||||
Map<String, Object> paramValues = sinfo.getParamValues();
|
Map<String, Object> paramValues = sinfo.getParamValues();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (String n : sinfo.getParamNames()) {
|
for (String n : sinfo.getParamNames()) {
|
||||||
@@ -2651,7 +2652,7 @@ public class DataJdbcSource extends AbstractDataSqlSource {
|
|||||||
set.close();
|
set.close();
|
||||||
conn.offerQueryStatement(prestmt);
|
conn.offerQueryStatement(prestmt);
|
||||||
}
|
}
|
||||||
slowLog(s, sinfo.getNativeCountSql());
|
slowLog(s, countSql);
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
String listSql = sinfo.getNativeSql();
|
String listSql = sinfo.getNativeSql();
|
||||||
if (mysqlOrPgsql) {
|
if (mysqlOrPgsql) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package org.redkale.source;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.IntFunction;
|
import java.util.function.IntFunction;
|
||||||
|
import org.redkale.annotation.Nullable;
|
||||||
import org.redkale.convert.ConvertDisabled;
|
import org.redkale.convert.ConvertDisabled;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
import org.redkale.convert.json.JsonConvert;
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ public class DataNativeSqlStatement {
|
|||||||
protected String nativeSql;
|
protected String nativeSql;
|
||||||
|
|
||||||
//根据参数值集合重新生成的带?参数可执行的计算总数sql,用于返回Sheet对象
|
//根据参数值集合重新生成的带?参数可执行的计算总数sql,用于返回Sheet对象
|
||||||
|
@Nullable
|
||||||
protected String nativeCountSql;
|
protected String nativeCountSql;
|
||||||
|
|
||||||
//需要预编译的##{xxx}、#{xxx}参数名, 数量与sql中的?数量一致
|
//需要预编译的##{xxx}、#{xxx}参数名, 数量与sql中的?数量一致
|
||||||
|
|||||||
Reference in New Issue
Block a user