mirror of
https://github.com/Wisser/Jailer.git
synced 2026-05-22 02:46:36 -05:00
new DBMS property: limitedFetchSize
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user