Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get SQLite compile_options from Qt SQLite
#include <QCoreApplication>
#include <QTextStream>
#include <QSqlDatabase>
#include <QSqlQuery>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QTextStream out(stdout);
QTextStream err(stderr);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(":memory:");
if (!db.open())
{
err << "Error opening database" << endl;
return 1;
}
QSqlQuery query;
if (!query.exec("PRAGMA compile_options"))
{
err << "Error querying compile options" << endl;
return 1;
}
out << "Qt built-in SQLite compile options:" << endl;
while (query.next())
out << query.value(0).toString() << endl;
return 0;
}
QT += core sql
QT -= gui
CONFIG += c++11
TARGET = sqlite_compile_options
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
@wincentbalin
Copy link
Author

wincentbalin commented Dec 22, 2017

Example for statically compiled Qt 4.8.7:
qt-4 8-sqlite-compile-options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment