Commit 1cbfcb19 by Qiang Xue

clean up

parent b22e3b9f
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
namespace yii\db; namespace yii\db;
use yii\db\Exception;
/** /**
* Command represents a SQL statement to be executed against a database. * Command represents a SQL statement to be executed against a database.
* *
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
namespace yii\db; namespace yii\db;
use yii\db\Exception;
use yii\base\BadConfigException; use yii\base\BadConfigException;
/** /**
...@@ -334,7 +333,7 @@ class Connection extends \yii\base\ApplicationComponent ...@@ -334,7 +333,7 @@ class Connection extends \yii\base\ApplicationComponent
try { try {
\Yii::trace('Opening DB connection: ' . $this->dsn, __CLASS__); \Yii::trace('Opening DB connection: ' . $this->dsn, __CLASS__);
$this->pdo = $this->createPdoInstance(); $this->pdo = $this->createPdoInstance();
$this->initConnection($this->pdo); $this->initConnection();
} }
catch (\PDOException $e) { catch (\PDOException $e) {
\Yii::error("Failed to open DB connection ({$this->dsn}): " . $e->getMessage(), __CLASS__); \Yii::error("Failed to open DB connection ({$this->dsn}): " . $e->getMessage(), __CLASS__);
...@@ -380,8 +379,9 @@ class Connection extends \yii\base\ApplicationComponent ...@@ -380,8 +379,9 @@ class Connection extends \yii\base\ApplicationComponent
/** /**
* Initializes the DB connection. * Initializes the DB connection.
* This method is invoked right after the DB connection is established. * This method is invoked right after the DB connection is established.
* The default implementation sets the database [[charset]] and executes SQLs specified * The default implementation turns on `PDO::ATTR_EMULATE_PREPARES`
* in [[initSQLs]]. * if [[emulatePrepare]] is true, and sets the database [[charset]] if it is not empty.
* It then triggers an [[afterOpen]] event.
*/ */
protected function initConnection() protected function initConnection()
{ {
...@@ -408,8 +408,7 @@ class Connection extends \yii\base\ApplicationComponent ...@@ -408,8 +408,7 @@ class Connection extends \yii\base\ApplicationComponent
'connection' => $this, 'connection' => $this,
'sql' => $sql, 'sql' => $sql,
)); ));
$command->bindValues($params); return $command->bindValues($params);
return $command;
} }
/** /**
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
namespace yii\db; namespace yii\db;
use yii\db\Exception;
use yii\base\BadConfigException; use yii\base\BadConfigException;
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment