silentyears
26th February 2014, 15:44
Hi,
To select all the rows(around 20000 rows) from table in the Oracle database, i use QSqlTableModel like this:
QSqlTableModel model;
model.setTable(tableA);
model.select();
while (model.canFetchMore())
{
model.fetchMore();
}
int nRowCount = model.rowCount();
for(int i = 0; i<nRowCount; i++)
{
//handle each row
//..
//..
}
But using canFetchMore() and fetchMore() in a while loop to get all the rows need too much time, so i refer to this article http://www.qtcentre.org/threads/12637-QSqlQueryModel-speed-problem. Then i plan to start serval threads in MyModel(inherits RemoteTableModel as illustrated in article), each thread start to select part of table and add the part into MyModel, but i am not sure how to do it in details, could i use QSqlTableModel to select in each thread?
Could you give me some tips or any better way?
Thanks!
To select all the rows(around 20000 rows) from table in the Oracle database, i use QSqlTableModel like this:
QSqlTableModel model;
model.setTable(tableA);
model.select();
while (model.canFetchMore())
{
model.fetchMore();
}
int nRowCount = model.rowCount();
for(int i = 0; i<nRowCount; i++)
{
//handle each row
//..
//..
}
But using canFetchMore() and fetchMore() in a while loop to get all the rows need too much time, so i refer to this article http://www.qtcentre.org/threads/12637-QSqlQueryModel-speed-problem. Then i plan to start serval threads in MyModel(inherits RemoteTableModel as illustrated in article), each thread start to select part of table and add the part into MyModel, but i am not sure how to do it in details, could i use QSqlTableModel to select in each thread?
Could you give me some tips or any better way?
Thanks!