-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
4.5.0
-
None
When upgrading from Qt 4.5 tp1 to Qt 4.5 beta. Some codes using QSqlTableModel failed when calling submitAll().
The environment is: Linux/CensOS 5, MySQL 5.1.30. The codes example is as following, I wonder it is a bug or I have missed something.
QSqlTableModel planTab( 0, *m_pSqlDB );
planTab.setEditStrategy( QSqlTableModel::OnManualSubmit );
planTab.setTable( strTab.c_str() );
tm_st_pg_t::const_iterator iterTm = thePlan.begin();
while( iterTm != thePlan.end() ){
const string tm = iterTm->first;
st_pg_t::const_iterator iterST = iterTm->second.begin();
while( iterST != iterTm->second.end() ){
const string st = iterST->first;
const double pg = iterST->second;
QSqlRecord theRec = planTab.record();
theRec.setValue( "tm", QString::fromLocal8Bit( tm.c_str() ) );
theRec.setValue( "st", QString::fromLocal8Bit( st.c_str() ));
theRec.setValue( "pg", QString::number( pg ) );
planTab.insertRecord( -1, theRec );
++iterST;
}
++iterTm;
}
planTab.submitAll();