Skip to content

Instantly share code, notes, and snippets.

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");
if (!
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 (
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
SOURCES += main.cpp
Copy link

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