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