Hello,
By default, QxOrm library prints all SQL queries in output console.
You can use the following option to make logs more "readable" :
- Code: Select all
qx::QxSqlDatabase::getSingleton()->setFormatSqlQueryBeforeLogging(true);
If you want to redirect all logs to an output file, then you have to use this Qt feature (
qInstallMessageHandler) :
- Code: Select all
qInstallMessageHandler(myMessageOutput);
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
// write all logs to an output file...
}
More details here :
https://stackoverflow.com/questions/495 ... etc-outputQxOrm QxSqlDatabase singleton class provides other options about SQL queries :
-
setTraceSqlQuery() : enable or disable SQL queries logs
-
setTraceSqlRecord() : trace all SQL result rows values
-
setTraceSqlBoundValues() : trace SQL queries placeholder values (? for example)
-
setTraceSqlBoundValuesOnError() : trace SQL queries placeholder values (? for example) only when an error occurred
-
setFormatSqlQueryBeforeLogging() : add some break line for pretty printing SQL queries
-
setTraceSqlOnlySlowQueriesDatabase() : trace only slow SQL queries (response time from database)
-
setTraceSqlOnlySlowQueriesTotal() : trace only slow SQL queries (C++ parsing + response time from database)