Created
December 22, 2017 23:24
-
-
Save wincentbalin/27a83ff01da327ae22d06356b84ce585 to your computer and use it in GitHub Desktop.
Get SQLite compile_options from Qt SQLite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QT += core sql | |
QT -= gui | |
CONFIG += c++11 | |
TARGET = sqlite_compile_options | |
CONFIG += console | |
CONFIG -= app_bundle | |
TEMPLATE = app | |
SOURCES += main.cpp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example for statically compiled Qt 4.8.7: