Hi all!

I suspect QSqlTableModel.rowCount cannot return numbers above 256.

For this finding could somebody please write me a mini-example of the
QSqlTableModel.beforeInsert?

Look, this outputs 256 for me (python 3.1.2, pyqt 4.8.1, XP SP3)

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

import sys
from PyQt4.QtCore import *
from PyQt4.QtSql import *
from PyQt4.QtGui import *

app = QApplication(sys.argv)
db = QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName('test.db')
db.open()

query = QSqlQuery('CREATE TABLE "preferences" ("id"  INTEGER PRIMARY
KEY  AUTOINCREMENT  NOT NULL, "value" varchar)')

model = QSqlTableModel(db=db)
model.setTable('preferences')
model.select()

for i in range(300):
   record = model.record()
   record.setValue('value', str(i))
   res = model.insertRecord(-1, record)
model.submitAll()
print(model.rowCount())

del model, db

thanks
Gergo

+-[ Gergely Kontra <pihent...@gmail.com> ]------------------+
|                                                           |
| Mobile:(+36 20)356 9656                                   |
|                                                           |
+- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to