PHP development framework YiiFramework tutorial (23) database-overview
Yii provides powerful database programming support.
The Yii Data Access Object (DAO) is built on the data object (PDO) extension of PHP, so that a single unified interface can access different database management systems (DBMS ). Applications developed using DAO of Yii can easily switch to different database management systems without modifying the data access code.
Yii's Active Record (AR) implements the widely used object relationship ORM ing (ORM) method to further simplify database programming. According to the conventions, a class represents a table, and an instance represents a row of data. Yii AR eliminates the repetitive tasks of most SQL statements used to process CRUD (create, read, update, and delete) data operations.
Although Yii DAO and AR can process almost all database-related tasks, you can still use your own database in Yii application. In fact, the Yii Framework is well designed to be used together with other third-party libraries.
The Yii Framework supports the following data interfaces:
Active Record
Query Builder
DAO
The example database used in this tutorial is
Chinook Database. The example Database is a famous NorthWind Database. Currently, the supported data types include:
DB2
EffiProz
MySQL
Oracle
PostgreSQL
SQL Server
SQL Server Compact
SQLite
The data model is:
This tutorial mainly uses MySQL, mainly because MySQL is the most frequently used database type in combination with PHP. Therefore, you need to install MySQL database. the Yii frame supports multiple database types, the interfaces supporting these databases are similar. Therefore, even though MySQL is used in this tutorial, the knowledge used is also applicable to other database types.