[Qt-interest] mqsql query terminating at 100th result
Bill King
bill.king at nokia.com
Wed Feb 3 00:25:47 CET 2010
You'll have better luck creating a bugreport, especially if it has a
reproducible testcase.
Just sayin' ;)
Bill.
On 02/03/2010 02:38 AM, ext Andre Somers wrote:
> Robert Wood wrote:
>
>> It seems to be something purely to do with my primary key.
>>
>> I've tried this QSqlQueryModel after hours of digging:
>>
>> QSqlQueryModel model;
>> model.setQuery("SELECT * FROM " + ui->tablesComboBox->currentText());
>>
>>
>> rows = model.rowCount();
>> ui->tableWidget->setRowCount(rows);
>> int idNumber;
>> for (j=0;j<rows;j++)
>> {
>> idNumber = model.data(model.index(j, 0)).toInt();
>> queryString = QString::number(idNumber, 10);
>> QTableWidgetItem *qTItem = new QTableWidgetItem;
>> qTItem->setText(queryString);
>> ui->tableWidget->setItem(j,0,qTItem);
>> }
>>
>> The problem is that, again, I get back the correct number of rows, I
>> make my Qt table as long as the sql table, but once I get to the 100th
>> member of the sql table, the idNumber returned is 0! Also, on one of my
>> large tables there is something weird going on where the 29th member has
>> a primary key of 667 and this returns 0. So it definitely seems to be
>> the return value of the primary key only being accepted when it's less
>> than 100 which seems crazy.
>>
>> As the primary keys are so important in linking to other tables, I find
>> it hard to believe this is a bug, but after almost three days on this, I
>> just can't see what on earth is going on.
>>
>> Has no-one else come across this? Am I going about it on the wrong way
>> still? Is it possible that this really is a bug?
>>
>> Really would appreciate some help on this!
>>
>>
> I admire your persiverence.
> Yes, it is certainly possible that there is a bug. I can't test it, but
> I had my own share of problems with the QODBC database driver once,
> where a double field was read incorrectly. It would fail on numbers
> smaller than 1, which happened to occur rather frequently. I had to hack
> around it by multiplying with a large number in my query, read the data,
> and devide the number again from code. Very ugly, I know, but the bug is
> really there.
>
> I know this particular example does not help you with your problem, but
> it may support your in your idea that your own code may not be the
> culprit. Perhaps it is time to try to debug the Qt code itself. Also, I
> recommend you try to contact Bill King. He is active on this list
> occasionally, and he seems to be working on the Qt SQL module. Perhaps
> the "Send a message" button on this page would work:
> http://gitorious.org/~billking
>
> André
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Bill King, Software Engineer
Qt Development Frameworks, Nokia Pty Ltd
Brisbane Office
More information about the Qt-interest-old
mailing list