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

Robert Wood robert.wood at apostrophe.co.uk
Mon Feb 1 00:29:53 CET 2010


Andreas Unger wrote:
 > Hello,
 >
 > Just out of curiosity, does the method which contains the
 > while(query.next()) loop get called more than once? If so, does this
 > issue of termination at the 100th entry occur the very first time you go
 > into the while loop?
 >
 > Cheers,
 > Andreas
 >

Hi Andreas,

Hopefully I understand the question correctly (I've put the code in 
below again for clarity):

I am calling that routine when a button is pressed. A combo box has 
selected the particular table name, so if I set a breakpoint at the line:

pos = query.at();

I hit that line 99 times, the variable "line" counts up to 99 (pos is 
actually at 98). If I then single step through the code I hit the 
while(query.next()) code and it drops out of the while loop.

The breakpoint is set before I start the program, so the while loop ,ust 
be only called once.

Cheers,

Rob


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

        line = 0;
        while(query.next())
                {
                pos = query.at();
                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++;
                }







More information about the Qt-interest-old mailing list