Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QSqlRelationalTableModel and "Lazy population"

[SOLVED] QSqlRelationalTableModel and "Lazy population"

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k Views
  • 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 Offline
    D Offline
    Dronissimo
    wrote on 20 Nov 2012, 11:46 last edited by
    #1

    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
    0
    • D Offline
      D Offline
      Dronissimo
      wrote on 22 Nov 2012, 11:31 last edited by
      #2

      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
      0
      • G Offline
        G Offline
        gayu
        wrote on 22 Nov 2012, 11:46 last edited by
        #3

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

        1 Reply Last reply
        0

        1/3

        20 Nov 2012, 11:46

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved