Suppose I have a table called 'logs' in mysql and I want to get the create query of this table in Qt(5.2 mingw). Here is what I have done so far:

Qt Code:
  1. QSqlQuery query(connection);
  3. query.prepare("SHOW CREATE TABLE logs");
  4. if(query.exec())
  5. {
  6. if(
  7. query.value(1).toString();
  8. }
To copy to clipboard, switch view to plain text mode 
After executing the code, the query.exec() returns true but the returns false. This query executes successfully in the mysql client(navicat) so I'm pretty sure about the query.

Note that QSqlQuery::lastError() gives -1 means no error!

I'll appreciate for any guidance or help.