diff --git a/src/main/engine/net/sf/jailer/JailerVersion.java b/src/main/engine/net/sf/jailer/JailerVersion.java index 6fbb77a59..3f81a1b74 100644 --- a/src/main/engine/net/sf/jailer/JailerVersion.java +++ b/src/main/engine/net/sf/jailer/JailerVersion.java @@ -25,7 +25,7 @@ public class JailerVersion { /** * The Jailer version. */ - public static final String VERSION = "14.5.0.2"; + public static final String VERSION = "14.6"; /** * The Jailer working tables version. @@ -45,7 +45,3 @@ public static void main(String[] args) { } } - - -// TODO -// TODO engine release pending (14.6). See DBMS#getLimitedFetchSize() diff --git a/src/main/engine/net/sf/jailer/configuration/DBMS.java b/src/main/engine/net/sf/jailer/configuration/DBMS.java index 525f40c80..be59a2889 100644 --- a/src/main/engine/net/sf/jailer/configuration/DBMS.java +++ b/src/main/engine/net/sf/jailer/configuration/DBMS.java @@ -1381,17 +1381,33 @@ public boolean equals(Object obj) { return true; } + private static final ThreadLocal tmpFetchSize = new ThreadLocal<>(); + + public static void setTmpFetchSize(Integer tmpFetchSize) { + DBMS.tmpFetchSize.set(tmpFetchSize); + } + public int getLimitedFetchSize(long limit) { - final int DEFAULT_FETCH_SIZE = 20010; Integer fSize = getFetchSize(); if (fSize != null) { - if (limit > 0 && limit <= DEFAULT_FETCH_SIZE) { - return (int) (limit + 1 + 1); - } else { + if (fSize < 0) { return fSize; } + } + + final int DEFAULT_FETCH_SIZE = 5010; + if (fSize == null) { + fSize = DEFAULT_FETCH_SIZE; + } + + Integer dfs = tmpFetchSize.get(); + if (dfs == null) { + dfs = fSize; + } + if (limit > 0 && limit <= dfs) { + return (int) (limit + 1 + 1); } else { - return DEFAULT_FETCH_SIZE; + return dfs; } } diff --git a/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java b/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java index c10411e9d..1cbfd4e77 100644 --- a/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java +++ b/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java @@ -87,6 +87,7 @@ import org.fife.ui.rtextarea.SmartHighlightPainter; import net.sf.jailer.ExecutionContext; +import net.sf.jailer.configuration.DBMS; import net.sf.jailer.database.InlineViewStyle; import net.sf.jailer.database.Session; import net.sf.jailer.database.Session.AbstractResultSetReader; @@ -2293,19 +2294,24 @@ public void readCurrentRow(ResultSet resultSet) throws SQLException { } } }; - if (orderBy) { - Map prev = new HashMap(result); - try { - session.executeQuery(sqlQuery + " order by " + (inSQLConsole()? "val" : columnName), reader, null, cancellationContext, MAX_NUM_DISTINCTEXISTINGVALUES + 2); - } catch (SQLException e) { - result.clear(); - result.putAll(prev); - // try without ordering + DBMS.setTmpFetchSize(25100); + try { + if (orderBy) { + Map prev = new HashMap(result); + try { + session.executeQuery(sqlQuery + " order by " + (inSQLConsole()? "val" : columnName), reader, null, cancellationContext, MAX_NUM_DISTINCTEXISTINGVALUES + 2); + } catch (SQLException e) { + result.clear(); + result.putAll(prev); + // try without ordering + session.executeQuery(sqlQuery, reader, null, cancellationContext, MAX_NUM_DISTINCTEXISTINGVALUES + 2); + sortValues(result, columnIndex); + } + } else { session.executeQuery(sqlQuery, reader, null, cancellationContext, MAX_NUM_DISTINCTEXISTINGVALUES + 2); - sortValues(result, columnIndex); } - } else { - session.executeQuery(sqlQuery, reader, null, cancellationContext, MAX_NUM_DISTINCTEXISTINGVALUES + 2); + } finally { + DBMS.setTmpFetchSize(null); } } @@ -2633,7 +2639,3 @@ public void close() { } -// TODO -// TODO Abteilung1.ObjektId wird auf 62 nicht gecached?! - -