[Qt-interest] mqsql query terminating at 100th result

Robert Wood robert.wood at apostrophe.co.uk
Sun Jan 31 17:58:37 CET 2010


Folks,

I am taking some baby steps into knocking up a fairly simply database 
front end. I have a load of tables created in knoda and I can happily 
connect to the database and open and examine all the tables.

However, when the tables are greater than 99 rows, even though the 
query.size() returns the correct number of rows, the query.next() just 
terminates at the 100th entry.

My code is here:

	queryString = "SELECT * FROM " + ui->tablesComboBox->currentText();
	query.exec(queryString);
	rows = query.size();

	line = 0;
	while(query.next())
		{
		pos = query.at();
		line++;
		ui->tableWidget->insertRow(pos);	
		queryString = "";
		for (j=0;j<columns;j++)
			{
			queryString = query.value(j).toString();
			QTableWidgetItem *qTItem = new QTableWidgetItem;
			qTItem->setText(queryString);
			ui->tableWidget->setItem(line,j,qTItem);			
			}
		line++;	
		}

This fills up my table very nicely in terms of reading all the values in 
all the columns until I hit line 100 where the while (query.next()) loop 
exits. I get pos returning 4,294,967,294 in qt creator, which is -2, the 
result for the end of table I think. What I find odd is that the line:

rows = query.size();

Does give figures much greater than 99 reflecting te real size of the 
table.

Can any one shed any light on this please?

Many thanks!



More information about the Qt-interest-old mailing list