[Qt-interest] qsqlquery: method query.next() makes call to database!!!

Roland Tollenaar rwatollenaar at gmail.com
Mon Jul 5 13:50:00 CEST 2010


Hi,

I have discovered something rather surprising and that is that in code 
of the following flow:

%%%%%%%%%%%%%%%%%%%%%%%%

QSqlquery query;
QStringList StoreList;

bool ok=query.exec("SELECT * from LargeTable");



if(ok){

	QMessageBox::information("data retrieved succesfully!");

	while(query.next()){
		StoreList<<query.value(0).toString();
	}
	

}

%%%%%%%%%%%%%%%%%%%%%%%

that during the period that the program is working in the while loop, it 
is not possible to disconnect the PC from the network if the database is 
not on the local machine.

In other words, the next() call or the value() call accesses the 
database server.!

In our specific case this is a problem.

The question is: Is it possible to set the behavior of QSQlquery to load 
all records onto the local machine before processing?

TIA,

Regards,

Roland








More information about the Qt-interest-old mailing list