Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED] QSqlRelationalTableModel and "Lazy population"

    General and Desktop
    2
    3
    1513
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Dronissimo last edited by

      Good day everyone .
      Could somebody tell me why when I have

      @
      /Connection.h/

      bool connection () {
      QSqlDatabase con = QSqlDatabase::addDatabase ("QMYSQL");
      con.setHostName("192.168.1.116");
      con.setUserName("bacula");
      con.setPassword("****");
      con.setDatabaseName("test");
      if (con.open () ) {
      qDebug() << "Connection OK";
      }
      }@

      @
      /*MAIN.cpp */
      Connection();
      QSqlRelationalTableModel * model = new QSqlRelationalTableModel();
      model->setTable("MAIN");
      model->setRelation(2,QSqlRelation("Prop_Org","Code","OrgName"));
      model->setRelation(1,QSqlRelation("Prop_Vid","Code","VidName"));
      model->setRelation(5,QSqlRelation("Sources","Code","Name"));
      model->select() ;
      QTableView * view = new QTableView ();
      view->setModel(model);
      view->show();@

      I DON'T have "lazy population" ,but if i replace Connection.h by Connection_ODBC.h which is using ODBC driver ,

      @
      /connection_ODBC.h/

      bool connection () {
      QSqlDatabase mbase = QSqlDatabase::addDatabase("QODBC");
      mbase.setDatabaseName("Paradox");
      if ( mbase.open() )
      qDebug()<< QString ("Paradox connection OK ");
      }
      @

      every works fine .
      Is it could happens because in first time i using Mysql and in second Paradox ? ( data in database the same , i make a migration from Paradox to Mysql and trying to have the same behavior)
      Maybe I miss something ? Please I need your advice .
      thank you for your time and forgive me my English it is not my native .

      1 Reply Last reply Reply Quote 0
      • D
        Dronissimo last edited by

        Ok I resolve it my self , the trick was in my database
        "Lazy population" doesn't work if
        @QSqlDriver::hasFeature(QSqlDriver::QuerySize)@ return true
        Hope this may help somebody .

        1 Reply Last reply Reply Quote 0
        • G
          gayu last edited by

          Add “[SOLVED]” to the topic’s title :)

          1 Reply Last reply Reply Quote 0
          • First post
            Last post