Browse Source

clean up

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
1cbfcb1955
  1. 2
      framework/db/Command.php
  2. 11
      framework/db/Connection.php
  3. 1
      framework/db/Transaction.php

2
framework/db/Command.php

@ -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.
* *

11
framework/db/Connection.php

@ -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
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
/** /**
* 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
'connection' => $this, 'connection' => $this,
'sql' => $sql, 'sql' => $sql,
)); ));
$command->bindValues($params); return $command->bindValues($params);
return $command;
} }
/** /**

1
framework/db/Transaction.php

@ -9,7 +9,6 @@
namespace yii\db; namespace yii\db;
use yii\db\Exception;
use yii\base\BadConfigException; use yii\base\BadConfigException;
/** /**

Loading…
Cancel
Save