I'm developing an application using qt and sqlite. There seems to be a problem with my installation of debian or its packging.
Here is my code:
Code: Select all
QString dbPath = ":memory:";
qDebug() << QSqlDatabase::drivers();
addDatabase("QSQLITE", "QSQLITE");
setDatabaseName(dbPath);
if (!isValid()) {
qFatal("QSQLITE database type is reported invalid by your operating system!\n%s", qPrintable(lastError().text()));
}
if (!open())
qFatal("Failed to open database at '%s'\n%s", qPrintable(dbPath), qPrintable(lastError().text()));
Code: Select all
QSqlDatabase::isValid()
This one:
Code: Select all
qDebug() << QSqlDatabase::drivers();
Code: Select all
("QSQLITE", "QMARIADB", "QMYSQL", "QMYSQL3")
Code: Select all
QSqlDatabase::lastError().text()
Code: Select all
Driver not loaded Driver not loaded
Code: Select all
ldd /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlite.so
Code: Select all
linux-vdso.so.1 (0x00007ffd54bb0000)
libQt5Sql.so.5 => /lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007fc1b7667000)
libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fc1b711c000)
libsqlite3.so.0 => /lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007fc1b6fd9000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc1b6e0c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc1b6c47000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc1b6c25000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fc1b6c06000)
libdouble-conversion.so.3 => /lib/x86_64-linux-gnu/libdouble-conversion.so.3 (0x00007fc1b6bef000)
libicui18n.so.67 => /lib/x86_64-linux-gnu/libicui18n.so.67 (0x00007fc1b68e9000)
libicuuc.so.67 => /lib/x86_64-linux-gnu/libicuuc.so.67 (0x00007fc1b6700000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc1b66fa000)
libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007fc1b6670000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007fc1b6593000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fc1b6464000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc1b6320000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc1b6306000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc1b76dd000)
libicudata.so.67 => /lib/x86_64-linux-gnu/libicudata.so.67 (0x00007fc1b47ed000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fc1b4778000)
Code: Select all
QT_DEBUG_PLUGINS=1
Code: Select all
loaded library "/usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlite.so"
Code: Select all
dpkg --get-selections | grep sqlite
Code: Select all
libqt5sql5-sqlite:amd64 install
libsqlite3-0:amd64 install
sqlitebrowser install
Code: Select all
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
I also noted that the application sqlitebrowser is working properly on my system and is using Qt. But ld command shows that this application uses libsqlite3 directly instead of Qt libraries!! So i decided to open a sqlite library directly from my project:
Code: Select all
sqlite3 *db;
int rc;
rc = sqlite3_open("/home/aario/Downloads/poet_assistant.db", &db);
if( rc ) {
qFatal("Can't open database: %s\n", sqlite3_errmsg(db));
} else {
qInfo("Opened database successfully through sqlite3 library\n");
}