Table of Contents
[ fromfile: database.xml id: database ]
Abstract
This chapter gives a general introduction to the capabilities of Qt's SQL classes, using Sqlite as an example back-end.
Qt provides a platform-neutral database interface similar to JDBC.[73]
It requires a driver for each specific database that it can connect to.
To build the driver against a specific database, the development header files of the database and also its libraries must be available.
You can use Qt to connect to a variety of different SQL databases, including Oracle, PostgreSQL, and Sybase SQL.
In the examples that follow, we have tested our code with MySQL and SQLite on Linux.
If you develop something new with QtSQL, we recommend using SQLite syntax because it:
Is open source.
Comes with Qt.
Does not require building Qt from source, or building a plugin, or setting up a standalone server.
Maps each database to a single file on disk.
Supports a subset of SQL which is available on most other systems.
What About Other Drivers? | |
---|---|
For more information, see the Qt SQL drivers documentation page. |
What Drivers Are Already Supported? | |
---|---|
To find out which drivers are available to the current version of Qt:
|
Object-Relational Mapping Layer | |
---|---|
If you want to completely isolate yourself from SQL and map objects directly to persistent storage, you might be interested in Code Synthesis ODB, an open source object-relational mapping layer with support for Qt types. |
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |