PDA

View Full Version : QSqlTableModel->submitAll()



maxel
5th September 2008, 15:43
Hey there,
i have got a problem with updating a Psql-Table. the code gets the results

QSqlTableModel* modelPerson= new QSqlTableModel(0,QSqlDatabase::database("user"));
modelPerson->setTable("ST_Person");
modelPerson->setEditStrategy(QSqlTableModel::OnManualSubmit);
modelPerson->setFilter("\"Person_No\"=48980");
if (!modelPerson->select())
{
QMessageBox::warning(this,"Person, modelPerson",modelPerson->lastError().text());
return;
}
QSqlRecord rec=modelPerson->record(0);
qDebug()<<"P1"<<modelPerson->record(0).value("Prename").toString();

rec.setValue(Prename","TEST");
modelPerson->setRecord(0,rec);

qDebug()<<"P2"<<modelPerson->record(0).value(Prename").toString();
bool r=modelPerson->submitAll();
qDebug()<<"result:"<<modelPerson->lastError().text();
qDebug()<<"P3"<<modelPerson->record(0).value("Prename").toString();
modelPerson->select();
qDebug()<<"P4"<<modelPerson->record(0).value(Prename").toString();

P1:"startPrename" ;//OK
P2:"Test";//OK
r become false!!!
result:" No Fields to update"
P3:"Test";//OK
P4:"startPrename";//OK, because not updatet

Why does the submitAll() fails?

maxel
6th September 2008, 08:30
switching down the qt version from qt4.41 to qt4.3.5 it works fine => it seems to be a bug in the psqldriver changes