[Qt-interest] mqsql query terminating at 100th result
Robert Wood
robert.wood at apostrophe.co.uk
Tue Feb 2 19:15:25 CET 2010
> Hi Robert,
>
> I have been following this thread with interest as I have bashed my head
> against a brick wall on a few Qt db issues myself (ouch!). I've not
> come across your issue before, but that doesn't mean I can afford to
> ignore it.
>
> One suggestion I would give that comes straight from a number of SQL
> Gurus is that 'SELECT * ...' is evil as a SQL construct; one should be
> specific about the fields that are returned. The reasons are many.
>
> I know that it might not help you in your present problem, but it might
> be worth a try.
>
> Ross Driedger
> ross_at_earz.ca
Hi Ross,
Many thanks for the suggestion. I had indeed, tried this:
model.setQuery("SELECT Component_ID 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);
}
Which is hardcoding the primary key of a specific table as my column to
query; I then chose the relevant table from my drop down box and asking
for the return values. I get the similar issue there too.
I'm in the middle of knocking up code to populate a table from my
program, to check whether it's an incompatibility with a previously
created table in a different front end. :~)
Thanks again for the suggestion.
Cheers,
Rob
More information about the Qt-interest-old
mailing list