Hi,
Im playing with sql and found some strange things
mSqlModel.setTable("test");
mSqlModel.select();
for(int row=0;row<500;row++)
{
record.
setValue("str1",
QVariant("blah"));
record.
setValue("str2",
QVariant("123abc"));
mSqlModel.insertRecord(-1,record);
if(!mSqlModel.submitAll())
std::cout << "Can't add row=" << std::endl;
}
mSqlModel.setTable("test");
mSqlModel.setEditStrategy(QSqlTableModel::OnManualSubmit);
mSqlModel.select();
for(int row=0;row<500;row++)
{
QSqlRecord record = mSqlModel.record();
record.setValue("str1",QVariant("blah"));
record.setValue("value",QVariant(row));
record.setValue("str2",QVariant("123abc"));
mSqlModel.insertRecord(-1,record);
if(!mSqlModel.submitAll())
std::cout << "Can't add row=" << std::endl;
}
To copy to clipboard, switch view to plain text mode
Maybe someone can help me here:
- mSqlModel.submitAll() returns always false
- If I run the code twice or more I only get 756 records (500 through the first run).
- If I run that in a seperate thread I get max 256 records
- if I use
mSqlModel.insertRecord(row,record);
mSqlModel.insertRecord(row,record);
To copy to clipboard, switch view to plain text mode
I get sometimes only 256 records added
Can someone tell me what I'm doing wrong here?
Thanks a lot.
Bookmarks