new DBMS property: limitedFetchSize

This commit is contained in:
Ralf Wisser
2023-04-14 14:45:22 +02:00
parent 5530285649
commit 8415100e48
3 changed files with 24 additions and 8 deletions
@@ -44,4 +44,8 @@ public class JailerVersion {
System.out.print(VERSION);
}
}
}
// TODO
// TODO engine release pending (14.6). See DBMS#getLimitedFetchSize()
@@ -1381,4 +1381,18 @@ public class DBMS {
return true;
}
public int getLimitedFetchSize(long limit) {
final int DEFAULT_FETCH_SIZE = 30000;
Integer fSize = getFetchSize();
if (fSize != null) {
if (limit > 0 && limit <= DEFAULT_FETCH_SIZE) {
return (int) (limit + 1 + 1);
} else {
return fSize;
}
} else {
return DEFAULT_FETCH_SIZE;
}
}
}
@@ -631,13 +631,11 @@ public class Session {
}
statement = theConnection.createStatement();
if (dbms != null) {
if (dbms.getFetchSize() != null) {
if (!wo || !DBMS.MySQL.equals(dbms)) {
try {
statement.setFetchSize(dbms.getFetchSize());
} catch (Throwable t) {
// ignore
}
if (!wo || !DBMS.MySQL.equals(dbms)) {
try {
statement.setFetchSize(dbms.getLimitedFetchSize(limit));
} catch (Throwable t) {
// ignore
}
}
}