Steps to operate the database using php:
First, open the database connection:mysql_connect();
Second, Open Table:mysql_select_db();
Third, implementation of the SQL statement:mysql_query();
Finally close the connection:mysql_close();
We use the same principle Yii Dao:
$connection = new CDbConnection($dsn,$username,$password);
$connection->active = true;
…
$connection->active = false;
Now I do not instantiate CDbConnection,But the use of Yii components "db";
$connection = Yii::app()->db;
I would like to know whether I should close the connection after completing the operation!
I need to use " $connection->active = false; " ?
I view the source code of Yii about CDbConnection and RA.
I found Yii operation of the database using the RA, when completed, did not close the database connection.
I mean yii do not use " $connection->active = false; ";
This looks like?
Is there a example about Yii dao?