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