Exemplo n.º 1
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);
     }
 }
Exemplo n.º 2
0
 /**
  * Returns the list of commands supported by the current
  * server profile.
  *
  * @param IServerProfile $profile Server profile instance.
  * @return array
  */
 protected function getCommands(IServerProfile $profile)
 {
     $commands = $profile->getSupportedCommands();
     return array_keys($commands);
 }