By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.
Bug 2115 - Native tqt3 sqlite3 driver is duplicated in the krecipes source code
Summary: Native tqt3 sqlite3 driver is duplicated in the krecipes source code
Status: RESOLVED FIXED
Alias: None
Product: TDE
Classification: Unclassified
Component: non-core programs (show other bugs)
Version: R14.0.0 [Trinity]
Hardware: Other Linux
: P5 minor
Assignee: Francois Andriot
URL:
Depends on:
Blocks:
 
Reported: 2014-09-15 14:10 CDT by Francois Andriot
Modified: 2015-10-20 09:18 CDT (History)
4 users (show)

See Also:
Compiler Version:
TDE Version String:
Application Version:
Application Name:


Attachments
krecipes: fix sqlite3 plugin (1.56 KB, patch)
2014-09-16 14:05 CDT, Francois Andriot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Andriot 2014-09-15 14:10:06 CDT
I'm don't know when this FTBFS appeared ... I've already built krecipes in the past without problem.


make[7]: Entering directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0/krecipes/src/backends/SQLite'
/bin/sh ../../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../.. -I. -I./.. -I./../.. -I/opt/trinity/include/tde -I/usr/include/tqt3 -I. -include tqt.h   -DQT_THREAD_SUPPORT  -D_REENTRANT  -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -c -o libkrecsqlite_la.all_cpp.lo libkrecsqlite_la.all_cpp.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../../.. -I. -I./.. -I./../.. -I/opt/trinity/include/tde -I/usr/include/tqt3 -I. -include tqt.h -DQT_THREAD_SUPPORT -D_REENTRANT -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -c libkrecsqlite_la.all_cpp.cpp  -fPIC -DPIC -o .libs/libkrecsqlite_la.all_cpp.o
In file included from ./../../backends/qsqlrecipedb.h:19:0,
                 from literecipedb.h:16,
                 from literecipedb.cpp:15,
                 from libkrecsqlite_la.all_cpp.cpp:2:
./../../backends/recipedb.h:100:2: warning: 'typedef' was ignored in this declaration [enabled by default]
  };
  ^
In file included from literecipedb.cpp:15:0,
                 from libkrecsqlite_la.all_cpp.cpp:2:
literecipedb.h: In member function 'virtual TQSqlDriver* LiteRecipeDB::qsqlDriver() const':
literecipedb.h:44:30: error: cannot allocate an object of abstract type 'KreSQLiteDriver'
   return new KreSQLiteDriver();
                              ^
In file included from literecipedb.h:20:0,
                 from literecipedb.cpp:15,
                 from libkrecsqlite_la.all_cpp.cpp:2:
qsql_sqlite.h:23:7: note:   because the following virtual functions are pure within 'KreSQLiteDriver':
 class KreSQLiteDriver : public TQSqlDriver
       ^
In file included from qsql_sqlite.h:14:0,
                 from literecipedb.h:20,
                 from literecipedb.cpp:15,
                 from libkrecsqlite_la.all_cpp.cpp:2:
/usr/include/tqt3/ntqsqldriver.h:101:18: note:  virtual bool TQSqlDriver::ping()
     virtual bool  ping() = 0;
                  ^
In file included from libkrecsqlite_la.all_cpp.cpp:3:0:
qsql_sqlite.cpp: At global scope:
qsql_sqlite.cpp:139:6: warning: unused parameter 'i' [-Wunused-parameter]
 bool KreSQLiteResult::isNull( int i )
      ^
In file included from literecipedb.cpp:15:0,
                 from libkrecsqlite_la.all_cpp.cpp:2:
literecipedb.h: In member function 'virtual TQSqlDriver* LiteRecipeDB::qsqlDriver() const':
literecipedb.h:45:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
make[7]: *** [libkrecsqlite_la.all_cpp.lo] Error 1
make[7]: Leaving directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0/krecipes/src/backends/SQLite'
make[6]: *** [all-recursive] Error 1
make[6]: Leaving directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0/krecipes/src/backends/SQLite'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0/krecipes/src/backends'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0/krecipes/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0/krecipes'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/dev/shm/BUILD.oss131.x86_64/trinity-krecipes-14.0.0~pre30+d58276f0'
Comment 1 Francois Andriot 2014-09-16 14:05:08 CDT
Created attachment 2246 [details]
krecipes: fix sqlite3 plugin

OK, there are several problems here.

1) TQT missing header.

in TQT3 package, we should provide the "qsql_sqlite3.h" header.
To do so automatically, add a symlink under "include" folder. E.g in tqt3 source dir:
  ln -s ../src/sql/drivers/sqlite3/qsql_sqlite3.h include/qsql_sqlite3.h

After installation, resulting file should be:
  /usr/include/tqt3/qsql_sqlite3.h


2) Krecipes is embedding its own tqt3-sqlite3 plugin source code.
Remove existing files in krecipes source dir:
  rm -f krecipes/src/backends/SQLite/qsql_sqlite.cpp krecipes/src/backends/SQLite/qsql_sqlite.h


3) Krecipes should use the TQT3 provided sqlite3 plugin. Apply attached patch in order to do so.
Comment 2 Timothy Pearson 2014-09-20 15:39:42 CDT
(In reply to Francois Andriot from comment #1)
> Created attachment 2246 [details]
> krecipes: fix sqlite3 plugin
> 
> OK, there are several problems here.
> 
> 1) TQT missing header.
> 
> in TQT3 package, we should provide the "qsql_sqlite3.h" header.
> To do so automatically, add a symlink under "include" folder. E.g in tqt3
> source dir:
>   ln -s ../src/sql/drivers/sqlite3/qsql_sqlite3.h include/qsql_sqlite3.h
> 
> After installation, resulting file should be:
>   /usr/include/tqt3/qsql_sqlite3.h

I'm trying to figure out how this is a good idea.  Those headers are private to Qt3/TQt3 so that they can be modified without breaking applications.  Additionally, Qt3/TQt3 does not install *any* DB-specific driver files, so only making this one SQLite driver available seems strange.

> 
> 2) Krecipes is embedding its own tqt3-sqlite3 plugin source code.
> Remove existing files in krecipes source dir:
>   rm -f krecipes/src/backends/SQLite/qsql_sqlite.cpp
> krecipes/src/backends/SQLite/qsql_sqlite.h

What I really want to know is why KRecipes and TDESVN are using this copied SQLite driver instead of using the standard TQSQLDatabase and/or TQSQLDriver classes.  If we are going to use the native Qt3/TQt3 database classes then these programs should be modfied to use those classes correctly.

For now, I patched the KRecipies driver for compatibility with the newer SQL driver API in GIT hash d860b31.
Comment 3 Francois Andriot 2014-09-20 16:15:31 CDT
(In reply to Timothy Pearson from comment #2)
> I'm trying to figure out how this is a good idea.  Those headers are private
> to Qt3/TQt3 so that they can be modified without breaking applications. 
> Additionally, Qt3/TQt3 does not install *any* DB-specific driver files, so
> only making this one SQLite driver available seems strange.

After my patch, krecipes still manages to read/write the SQLITE3 database correctly.
TQT3 is installing db-specific drivers as "plugins", e.g. in my system I have:
  /usr/lib64/tqt3/plugins/sqldrivers/libqsqlite3.so

Also, the db-drivers headers are all installed to /usr/include/tqt3/qsql_* .
(except sqlite3, which is why I created a patch)


> What I really want to know is why KRecipes and TDESVN are using this copied
> SQLite driver instead of using the standard TQSQLDatabase and/or TQSQLDriver
> classes.  If we are going to use the native Qt3/TQt3 database classes then
> these programs should be modfied to use those classes correctly.
> 
> For now, I patched the KRecipies driver for compatibility with the newer SQL
> driver API in GIT hash d860b31.


This is because the sqlite3 driver never went upstream in the old QT3/KDE3 days. I think every app developper had to find a way to add the driver itself.

The sqlite3 driver for TQT3 was added in Trinity some weeks ago. I believe it was a copy/paste from the Sqlite3 pluging provided in kmymoney (yes, it is also duplicated there).

Now that we are upstream for QT3/TQT3, I think we should delete the sqlite3 plugins from all applications that may embed it.
Comment 4 Slávek Banko 2014-10-03 19:42:15 CDT
Comment on attachment 2246 [details]
krecipes: fix sqlite3 plugin

I finished the patch from François and removed the local copy sqlite3 plugin. Private include files qsql_*.h is not needed to build Krecipes.

Pushed to GIT in hash c5d46138.
Comment 5 Slávek Banko 2014-10-04 03:18:25 CDT
François, please test it and then close this bug report.