You are here

function OAuthStorePDO::__construct in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
  2. 7.2 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
  3. 7.3 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
  4. 7.5 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
  5. 7.6 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()

* Construct the OAuthStorePDO. * In the options you have to supply either: * - dsn, username, password and database (for a new PDO connection) * - conn (for the connection to be used) * *

Parameters

array options:

Overrides OAuthStoreSQL::__construct

File

lib/oauth-php/library/store/OAuthStorePDO.php, line 50

Class

OAuthStorePDO

Code

function __construct($options = array()) {
  if (isset($options['conn'])) {
    $this->conn = $options['conn'];
  }
  else {
    if (isset($options['dsn'])) {
      try {
        $this->conn = new PDO($options['dsn'], $options['username'], @$options['password']);
      } catch (PDOException $e) {
        throw new OAuthException2('Could not connect to PDO database: ' . $e
          ->getMessage());
      }
      $this
        ->query('set character set utf8');
    }
  }
}