Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
b22e3b9f
Commit
b22e3b9f
authored
Jan 15, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added 'afterOpen' event to Connection.
parent
e150b7fa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
Connection.php
framework/db/Connection.php
+3
-9
No files found.
framework/db/Connection.php
View file @
b22e3b9f
...
...
@@ -96,6 +96,8 @@ use yii\base\BadConfigException;
* @property string $clientVersion The version information of the DB driver.
* @property array $stats The statistical results of SQL executions.
*
* @event Event afterOpen this event is triggered after a DB connection is established
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
...
...
@@ -234,10 +236,6 @@ class Connection extends \yii\base\ApplicationComponent
*/
public
$enableAutoQuoting
=
true
;
/**
* @var array a list of SQL statements that should be executed right after the DB connection is established.
*/
public
$initSQLs
;
/**
* @var array mapping between PDO driver names and [[Schema]] classes.
* The keys of the array are PDO driver names while the values the corresponding
* schema class name or configuration. Please refer to [[\Yii::createObject()]] for
...
...
@@ -394,11 +392,7 @@ class Connection extends \yii\base\ApplicationComponent
if
(
$this
->
charset
!==
null
&&
in_array
(
$this
->
getDriverName
(),
array
(
'pgsql'
,
'mysql'
,
'mysqli'
)))
{
$this
->
pdo
->
exec
(
'SET NAMES '
.
$this
->
pdo
->
quote
(
$this
->
charset
));
}
if
(
!
empty
(
$this
->
initSQLs
))
{
foreach
(
$this
->
initSQLs
as
$sql
)
{
$this
->
pdo
->
exec
(
$sql
);
}
}
$this
->
trigger
(
'afterOpen'
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment