[PyQt] QSqlTableModel.rowCount bug? (and still need infor for beforeInsert)

KONTRA, Gergely pihentagy at gmail.com
Fri Dec 3 16:13:31 GMT 2010


On Fri, Dec 3, 2010 at 15:56, Wolfgang Rohdewald <wolfgang at rohdewald.de>wrote:

> On Freitag 03 Dezember 2010, KONTRA, Gergely wrote:
> > Hi all!
> >
> > I suspect QSqlTableModel.rowCount cannot return numbers above
> > 256.
>
> rowCount is not the number of rows in the table but in the model,
> AFAIK. Use fetchMore() to load more.
>

Thats not logical.
http://doc.trolltech.com/4.7/qsqltablemodel.html#rowCountdoesn't
mention what is exactly rowCount, and one should expect the number
of rows based on the name...

fetchMore will then fetch all rows. I don't want that, just would like to
know the number of rows, or just load the last record.

> And can somebody tell me why this code is this painfully
slooow?

 you execute 300 transactions. If you use db.transaction()
> after db.open() and db.commit() after model.submitAll(), this
> is only one transaction and much faster.
>
Sounds reasonable, thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101203/f2700a83/attachment-0001.html>


More information about the PyQt mailing list