|
|
|
@ -230,17 +230,13 @@ public class SqlSelectImpl implements SqlSelect {
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean queryBooleanOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Boolean>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getBooleanOrNull();
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getBooleanOrNull();
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -259,337 +255,264 @@ public class SqlSelectImpl implements SqlSelect {
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
|
|
public Long queryLongOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Long>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Long process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getLongOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getLongOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public long queryLongOrZero() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Long>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Long process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getLongOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0L;
|
|
|
|
|
Long l = queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getLongOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0L;
|
|
|
|
|
});
|
|
|
|
|
return l != null ? l : 0L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Long> queryLongs() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<Long>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<Long> process(Rows rs) throws Exception {
|
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Long value = rs.getLongOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Long value = rs.getLongOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Integer queryIntegerOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Integer>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Integer process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getIntegerOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getIntegerOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int queryIntegerOrZero() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Integer>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Integer process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getIntegerOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
Integer i = queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getIntegerOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
});
|
|
|
|
|
return i != null ? i : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Integer> queryIntegers() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<Integer>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<Integer> process(Rows rs) throws Exception {
|
|
|
|
|
List<Integer> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Integer value = rs.getIntegerOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<Integer> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Integer value = rs.getIntegerOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Float queryFloatOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Float>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Float process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getFloatOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getFloatOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public float queryFloatOrZero() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Float>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Float process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getFloatOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0f;
|
|
|
|
|
Float f = queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getFloatOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0f;
|
|
|
|
|
});
|
|
|
|
|
return f!= null ? f : 0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Float> queryFloats() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<Float>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<Float> process(Rows rs) throws Exception {
|
|
|
|
|
List<Float> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Float value = rs.getFloatOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<Float> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Float value = rs.getFloatOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Double queryDoubleOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Double>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Double process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getDoubleOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getDoubleOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public double queryDoubleOrZero() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Double>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Double process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getDoubleOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0d;
|
|
|
|
|
Double d = queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getDoubleOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return 0d;
|
|
|
|
|
});
|
|
|
|
|
return d != null ? d : 0d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Double> queryDoubles() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<Double>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<Double> process(Rows rs) throws Exception {
|
|
|
|
|
List<Double> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Double value = rs.getDoubleOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<Double> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Double value = rs.getDoubleOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BigDecimal queryBigDecimalOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<BigDecimal>() {
|
|
|
|
|
@Override
|
|
|
|
|
public BigDecimal process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getBigDecimalOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getBigDecimalOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BigDecimal queryBigDecimalOrZero() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<BigDecimal>() {
|
|
|
|
|
@Override
|
|
|
|
|
public BigDecimal process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getBigDecimalOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return new BigDecimal(0);
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getBigDecimalOrZero(1);
|
|
|
|
|
}
|
|
|
|
|
return new BigDecimal(0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<BigDecimal> queryBigDecimals() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<BigDecimal>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<BigDecimal> process(Rows rs) throws Exception {
|
|
|
|
|
List<BigDecimal> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
BigDecimal value = rs.getBigDecimalOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<BigDecimal> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
BigDecimal value = rs.getBigDecimalOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String queryStringOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<String>() {
|
|
|
|
|
@Override
|
|
|
|
|
public String process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getStringOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getStringOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String queryStringOrEmpty() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<String>() {
|
|
|
|
|
@Override
|
|
|
|
|
public String process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getStringOrEmpty(1);
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getStringOrEmpty(1);
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> queryStrings() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<String>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> process(Rows rs) throws Exception {
|
|
|
|
|
List<String> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String value = rs.getStringOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<String> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
String value = rs.getStringOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Date queryDateOrNull() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<Date>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Date process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getDateOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getDateOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Date> queryDates() {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<Date>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<Date> process(Rows rs) throws Exception {
|
|
|
|
|
List<Date> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Date value = rs.getDateOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<Date> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Date value = rs.getDateOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDate queryLocalDateOrNull() {
|
|
|
|
|
// Date without time
|
|
|
|
|
return queryWithTimeout(new RowsHandler<LocalDate>() {
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDate process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getLocalDateOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rs.getLocalDateOrNull(1);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<LocalDate> queryLocalDates() {
|
|
|
|
|
// Date without time
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<LocalDate>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<LocalDate> process(Rows rs) throws Exception {
|
|
|
|
|
List<LocalDate> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
LocalDate value = rs.getLocalDateOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<LocalDate> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
LocalDate value = rs.getLocalDateOrNull(1);
|
|
|
|
|
if (value != null) {
|
|
|
|
|
result.add(value);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -600,18 +523,15 @@ public class SqlSelectImpl implements SqlSelect {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public <T> T queryOneOrNull(final RowHandler<T> rowHandler) {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<T>() {
|
|
|
|
|
@Override
|
|
|
|
|
public T process(Rows rs) throws Exception {
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
T result = rowHandler.process(rs);
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
T result = rowHandler.process(rs);
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
throw new ConstraintViolationException("Expected exactly one row to be returned but found multiple");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
throw new ConstraintViolationException("Expected exactly one row to be returned but found multiple");
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -626,14 +546,11 @@ public class SqlSelectImpl implements SqlSelect {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public <T> T queryFirstOrNull(final RowHandler<T> rowHandler) {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<T>() {
|
|
|
|
|
@Override
|
|
|
|
|
public T process(Rows rs) throws Exception {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rowHandler.process(rs);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
return rowHandler.process(rs);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -648,20 +565,15 @@ public class SqlSelectImpl implements SqlSelect {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public <T> List<T> queryMany(final RowHandler<T> rowHandler) {
|
|
|
|
|
return queryWithTimeout(new RowsHandler<List<T>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public List<T> process(Rows rs) throws Exception {
|
|
|
|
|
List<T> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
T row = rowHandler.process(rs);
|
|
|
|
|
if (row != null) {
|
|
|
|
|
result.add(row);
|
|
|
|
|
}
|
|
|
|
|
return queryWithTimeout(rs -> {
|
|
|
|
|
List<T> result = new ArrayList<>();
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
T row = rowHandler.process(rs);
|
|
|
|
|
if (row != null) {
|
|
|
|
|
result.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -757,7 +669,7 @@ public class SqlSelectImpl implements SqlSelect {
|
|
|
|
|
if (isSuccess) {
|
|
|
|
|
DebugSql.logSuccess("Query", log, metric, executeSql, parameters, options);
|
|
|
|
|
} else if (isWarn) {
|
|
|
|
|
DebugSql.logWarning("Query", log, metric, "QueryTimedOutException", executeSql, parameters, options, logEx);
|
|
|
|
|
DebugSql.logWarning("Query", log, metric, "QueryTimedOutException", executeSql, parameters, options, null);
|
|
|
|
|
} else {
|
|
|
|
|
DebugSql.logError("Query", log, metric, errorCode, executeSql, parameters, options, logEx);
|
|
|
|
|
}
|
|
|
|
|