Important: Please read the Qt Code of Conduct -

QMYSQL equivalent of MYSQL source function

  • Just wondering if anyone has had any success using the mysql source or . function with in Qt. I'm trying to do:
    @q.prepare("source myfile.tx");@

    But that is giving me a QMYSQL: Unable to execute query error. Same when I use . Is that not supported by QMYSQL? Any good workarounds?

  • There is no built-in method for this. You will have to read the file yourself into a QString and pass that to the prepare method of a QSqlQuery.

Log in to reply