[KPhotoAlbum] Patch to use the right database driver

Robert Krawitz rlk at alum.mit.edu
Sun Jan 7 14:57:54 GMT 2018


On Sun, 07 Jan 2018 13:36:37 +0100, Tobias Leupold wrote:
>>From the latest docs (Qt 5.10), cf. http://doc.qt.io/qt-5/qsqldatabase.html :
>
> QSqlDatabase::QSqlDatabase(const QString &type)
>
> The currently available driver types are:
> ..
> QSQLITE     SQLite version 3 or above
> QSQLITE2    SQLite version 2
> ..
>
> So apparently, using "QSQLITE" seems to be the right thing (and
> "QSQLITE3" is not listed) ... can you explain where you have your
> information from?

It looks like QSQLITE3 is an extension that akonadi is adding (at
least on openSUSE), but I figured it out via:

[2(rlk)||{!5}<rlk-mobile>/home/rlk]
$ rpm -qf /usr/lib64/qt5/plugins/sqldrivers/*
libQt5Sql5-sqlite-5.10.0-5.1.x86_64
akonadi-server-sqlite-17.12.0-135.1.x86_64
libQt5Sql5-mysql-5.10.0-5.1.x86_64
libQt5Sql5-unixODBC-5.10.0-5.1.x86_64
libQt5Sql5-postgresql-5.10.0-5.1.x86_64
[2(rlk)||{!6}<rlk-mobile>/home/rlk]
$ ls -l !$
ls -l /usr/lib64/qt5/plugins/sqldrivers/*
-rwxr-xr-x 1 root root 73432 Dec 29 13:39 /usr/lib64/qt5/plugins/sqldrivers/libqsqlite.so
-rwxr-xr-x 1 root root 69336 Dec 30 00:15 /usr/lib64/qt5/plugins/sqldrivers/libqsqlite3.so
-rwxr-xr-x 1 root root 81728 Dec 29 13:39 /usr/lib64/qt5/plugins/sqldrivers/libqsqlmysql.so
-rwxr-xr-x 1 root root 98080 Dec 29 13:39 /usr/lib64/qt5/plugins/sqldrivers/libqsqlodbc.so
-rwxr-xr-x 1 root root 81680 Dec 29 13:39 /usr/lib64/qt5/plugins/sqldrivers/libqsqlpsql.so

This came about because I was reading in new photos and it crashed in
query exec (which typically happens if you try to manipulate an
sqlite3 database from sqlite2), so I went rooting around and figured
out that this is where it was coming from.

> Am Sonntag, 7. Januar 2018, 01:14:02 CET schrieb Robert Krawitz:
>> It appears that at least with the latest Qt that we need to specify
>> the QSQLITE3 driver; QSQLITE uses the sqlite2 driver, which crashes
>> when it tries to open an sqlite3 database.
>> 
>> diff --git a/Exif/Database.cpp b/Exif/Database.cpp
>> index 237fa931..514978c1 100644
>> --- a/Exif/Database.cpp
>> +++ b/Exif/Database.cpp
>> @@ -115,7 +115,7 @@ static void showError( QSqlQuery& query )
>>  Exif::Database::Database()
>> 
>>      : m_isOpen(false)
>> 
>>  {
>> -    m_db = QSqlDatabase::addDatabase( QString::fromLatin1( "QSQLITE" ),
>> QString::fromLatin1( "exif" ) ); +    m_db = QSqlDatabase::addDatabase(
>> QString::fromLatin1( "QSQLITE3" ), QString::fromLatin1( "exif" ) ); }
>> 
>> 
>> @@ -370,7 +370,7 @@ bool Exif::Database::isAvailable()
>>  #ifdef QT_NO_SQL
>>      return false;
>>  #else
>> -    return QSqlDatabase::isDriverAvailable( QString::fromLatin1( "QSQLITE"
>> ) ); +    return QSqlDatabase::isDriverAvailable( QString::fromLatin1(
>> "QSQLITE3" ) ); #endif
>>  }

-- 
Robert Krawitz                                     <rlk at alum.mit.edu>

***  MIT Engineers   A Proud Tradition   http://mitathletics.com  ***
Member of the League for Programming Freedom  --  http://ProgFree.org
Project lead for Gutenprint   --    http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton



More information about the Kphotoalbum mailing list