From 75f4dc9eba1489032a2db90c3947fa9862a0d3ba Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 24 Feb 2010 08:18:47 +0000 Subject: [PATCH] Info window pagign - use cursor to load a subset of the result when native database paging is not available. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2913975 --- .../src/org/adempiere/webui/panel/InfoPanel.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index aed59da0a0..6c0cd85284 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -383,7 +383,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM MTable table = MTable.get(Env.getCtx(), tableName); if (table != null) { - m_useDatabasePaging = table.isHighVolume() && DB.getDatabase().isPagingSupported(); + m_useDatabasePaging = table.isHighVolume(); } } // prepareTable @@ -548,7 +548,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM String dataSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables dataSql = MRole.getDefault().addAccessSQL(dataSql, getTableName(), MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); - if (end > start && DB.getDatabase().isPagingSupported()) + if (end > start && m_useDatabasePaging && DB.getDatabase().isPagingSupported()) { dataSql = DB.getDatabase().addPagingSQL(dataSql, cacheStart, cacheEnd); } @@ -560,10 +560,22 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM log.fine("Start query - " + (System.currentTimeMillis()-startTime) + "ms"); m_rs = m_pstmt.executeQuery(); log.fine("End query - " + (System.currentTimeMillis()-startTime) + "ms"); + //skips the row that we dont need if we can't use native db paging + if (end > start && m_useDatabasePaging && !DB.getDatabase().isPagingSupported()) + { + m_rs.absolute(cacheStart-1); + } + int rowPointer = cacheStart-1; while (m_rs.next()) { + rowPointer++; readData(m_rs); + //check now of rows loaded, break if we hit the suppose end + if (m_useDatabasePaging && rowPointer >= cacheEnd) + { + break; + } } }