PDA

View Full Version : Statically linked QtSql modules



runderwo
3rd April 2007, 16:33
Is there a way to build the QtSql plugins as separate static libs, or must the entire Qt library be rebuilt with the plugins compiled into the monolithic library?

patrik08
3rd April 2007, 17:15
Is there a way to build the QtSql plugins as separate static libs, or must the entire Qt library be rebuilt with the plugins compiled into the monolithic library?


Depend how or which sql you use....
Firebird, Sqlite3 can build static... other depend from external Libs
Example MYSQL must have external dll or lib odbcunix or window is same....

Or you can build static an installer to but dll or libs on right place....

runderwo
3rd April 2007, 17:56
I would like to build a separate static lib for the Sqlite plugin, so I can just link the SQL driver lib into my project. This way I avoid having to maintain an entirely custom compiled static Qt library in the repository.

patrik08
3rd April 2007, 18:23
I would like to build a separate static lib for the Sqlite plugin, so I can just link the SQL driver lib into my project. This way I avoid having to maintain an entirely custom compiled static Qt library in the repository.

If you can grab code on subversion have a look on code:

http://sourceforge.net/projects/qtexcel-xslt/

is a excel "emulator" wo work on sqlite3 and convert in many other format....

is build on qt4.1 ... but i tested && you can build to on qt4.3 beta

on folder /static_sqlite_table/

otherwise you must write your own lib....

if you like to run on qt3 have a look on sqlitebrowser on sf.net

Tux-Slack
10th September 2007, 13:41
I'm going to ask my question here.
I have rebuilt Qt with the -static option passed to the configure script.

And then run qmake on my project and started to recompile. It compile good and it runs. But the problem is when I try to connect my app to SQLite database.
I get two messages:
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:

And this is how I construct it:

QSqlDatabase DB = QSqlDatabase::addDatabase(driver);
DB.setDatabaseName(QString(QDir::homePath()+"/.ma/%1").arg(dbName));
It worked like a charm before I didn't have compiled Qt with the -static option.
I am including the QtSql in the app.
And Qt version is 4.3.1 OpenSource

jacek
10th September 2007, 23:43
Try adding Q_IMPORT_PLUGIN(qsqlite) to your sources and QTPLUGIN += qsqlite to your .pro file.

http://doc.trolltech.com/4.2/plugins-howto.html#static-plugins