/**
  * Prepares a connection object after its initialization.
  *
  * @param SingleConnectionInterface $connection Instance of a connection object.
  */
 protected function prepareConnection(SingleConnectionInterface $connection)
 {
     if (isset($this->profile)) {
         $parameters = $connection->getParameters();
         if (isset($parameters->password)) {
             $command = $this->profile->createCommand('auth', array($parameters->password));
             $connection->pushInitCommand($command);
         }
         if (isset($parameters->database)) {
             $command = $this->profile->createCommand('select', array($parameters->database));
             $connection->pushInitCommand($command);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function pushInitCommand(CommandInterface $command)
 {
     return $this->connection->pushInitCommand($command);
 }