Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3364

QSqlTableModel failed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P3: Somewhat important
    • Some future release
    • 4.5.0
    • SQL Support
    • None

    Description

      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();
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bilking Bill King
            engvolds Morten Engvoldsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes