The Qt SQL drivers are then included in Qt_SQL_FILTER() instead of Q_PLUGIN_METADATA(). However, this is only a convenience for developers who are using the Qt libraries shipped with the Qt SDK. From a performance point of view, it is also recommended to use native client libraries instead. For many database drivers, it is possible to use them directly from the QtSQL module without creating a client driver, e.g. for the SQLite library you can use the QSqlDatabase::createDatabase() and QSqlDatabase::removeDatabase() functions.
If you are using the Qt libraries that come with the Qt SDK, it is also possible to write the SQL driver as a plugin and use the pre-defined Qt drivers for MS SQL Server, Oracle, PostgreSQL, SQLite, and InterBase. To do that, you need to add the Qt_SQL_FILTER macro to your project before you include QtCore, QtGui, and QtSql.
Whenever possible, use the QtSQL module's native SQL drivers instead of the pre-defined drivers. With the native drivers, you can use QtSql to access the database, instead of the QSqlDatabase class, and you do not have to manually create a QSqlDatabase from a QSqlDatabase::open(). For example, if you want to use SQLite, instead of calling QSqlDatabase::open(), you can use QSqlDatabase::database().open(). If you prefer to use the pre-defined driver, you can follow the examples in the Qt example directory.
You may be surprised to see that this library is not part of Qt. It is a standalone library that is distributed with your Qt installation. It is used in the source code to display SQLite databases in a Qt SQL datasource. If you want to use SQLite databases, you will have to download it from http://www.sqlite.org and then include it as a (static) library in your application.
QSQLITE is no longer maintained as it is considered deprecated. If you need a database drivers for SQLite, please take a look at the SQLite 3.7.3 source code , or use a different SQL database engine.
The SQL drivers use a plugin mechanism that enables you to load and unload drivers dynamically at runtime. You can use this mechanism to dynamically load and unload drivers that support a new database backend. You must not share the driver source code with the client library, so you can only share the binary plugin that is generated at build time.
By default, the driver will be loaded when you load a database connection with QSqlDatabase::addDatabase(). If you want the driver to be loaded at another time, for example when you start Qt, you should use QSqlDatabase::setSqlDriver(driver) instead.
SQLite is a powerful embedded database which supports multiple SQL dialects, and has a runtime library which can be linked statically or dynamically. It is a very portable solution, and is included with many Linux distributions. The SQLite driver builds natively on Windows and Mac OS X. 827ec27edc