Qt: SQL Programming
2012-06-08 23:16 Rollen Holt 阅读(1344) 评论(0) 编辑 收藏 举报SQL Programming
This overview assumes that you have at least a basic knowledge of SQL. You should be able to understand simple SELECT, INSERT, UPDATE, and DELETE statements. Although the QSqlTableModelclass provides an interface to database browsing and editing that does not require a knowledge of SQL, a basic understanding of SQL is highly recommended. A standard text covering SQL databases is An Introduction to Database Systems (7th Ed.) by C. J. Date, ISBN 0201385902.
Topics:
- Database Classes
- Connecting to Databases
- Executing SQL Statements
- Using the SQL Model Classes
- Presenting Data in a Table View
- Creating Data-Aware Forms
Database Classes
These classes provide access to SQL databases.
Contains miscellaneous identifiers used throughout the Qt SQL library |
|
Represents a connection to a database |
|
Abstract base class for accessing specific SQL databases |
|
Template class that provides a SQL driver factory for a specific driver type |
|
The base class for SQL driver factories |
|
SQL database error information |
|
Manipulates the fields in SQL database tables and views |
|
Functions to manipulate and describe database indexes |
|
Means of executing and manipulating SQL statements |
|
Read-only data model for SQL result sets |
|
Encapsulates a database record |
|
Editable data model for a single database table, with foreign key support |
|
Abstract interface for accessing data from specific SQL databases |
|
Editable data model for a single database table |
The SQL classes are divided into three layers:
Driver Layer
This comprises the classes QSqlDriver, QSqlDriverCreator<T>, QSqlDriverCreatorBase, QSqlDriverPlugin, and QSqlResult.
This layer provides the low-level bridge between the specific databases and the SQL API layer. See SQL Database Drivers for more information.
SQL API Layer
These classes provide access to databases. Connections are made using the QSqlDatabase class. Database interaction is achieved by using the QSqlQuery class. In addition to QSqlDatabase and QSqlQuery, the SQL API layer is supported by QSqlError, QSqlField,QSqlIndex, and QSqlRecord.
User Interface Layer
These classes link the data from a database to data-aware widgets. They include QSqlQueryModel, QSqlTableModel, andQSqlRelationalTableModel. These classes are designed to work with Qt's model/view framework.
Note that to use any of these classes, a QCoreApplication object must have been instantiated first.
==============================================================================
本博客已经废弃,不在维护。新博客地址:http://wenchao.ren
我喜欢程序员,他们单纯、固执、容易体会到成就感;面对压力,能够挑灯夜战不眠不休;面对困难,能够迎难而上挑战自我。他
们也会感到困惑与傍徨,但每个程序员的心中都有一个比尔盖茨或是乔布斯的梦想“用智慧开创属于自己的事业”。我想说的是,其
实我是一个程序员
==============================================================================