Project is using QMYSQL3 instead of QMYSQL?



  • I am having troubles retrieving results from a UNION query, it appears that someone else has had this issue in the past (http://permalink.gmane.org/gmane.comp.lib.qt.general/31200). I am not sure why it is loading QMYSQL3 but the link suggested that unions are not supported in QMYSQL3, is this true? I can substitute my query with any non-union query and it works fine, so the rest of the prepare/bind/execute code must be fine.. I have tried building from source as well as using the binary repositories, but neither fix my issue...

    @ QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "connection1");
    db.setHostName("-----");
    db.setUserName("-----");
    db.setPassword("-----");
    db.setPort(3306);
    db.setDatabaseName("-----");
    QSqlQuery query = QSqlQuery(db);
    query.prepare("large query with 1 UNION ALL)");
    query.addBindValue(98);
    query.exec();
    query.size(); // == 1
    query.first(); // == false
    query.next(); // == false
    query.lastError(); // == "QMYSQL3: Unable to fetch data"@



  • This was fixed by using the MariaDB driver instead of the MySQL... Not sure why this would fix it but it did!



  • This was fixed by using the MariaDB driver instead of the MySQL... Not sure why this would fix it but it did!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.