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
This commit is contained in:
Heng Sin Low 2010-02-24 08:18:47 +00:00
parent 2a74599b51
commit 75f4dc9eba
1 changed files with 14 additions and 2 deletions

View File

@ -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;
}
}
}