I have a query that returns 1000 rows in about 5 secs on a local network.
Exactly the same query takes about 5 mins to complete across the internet(fast one).

I am using odbc driver against MSSQL database.

I suspect that the code I wrote to retrieve records might be the problem.

Qt Code:
  1. QAbstractTableModel* DBOperations::executeSelectWithParam (const char* sql, QVariant param)
  2. {
  3. // db is an instance of QSqlDatabase, correctly initialized.
  4. try
  5. {
  6. QSqlQueryModel* retval = new QSqlQueryModel();
  7. retval->setQuery(sql, db);
  8. while (retval->canFetchMore())
  9. retval->fetchMore();
  10. return retval;
  11. }
  12. catch (...)
  13. {
  14. return NULL;
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 

Any advice/comment will be appreciated.