function OAuthStorePDO::__construct in Lingotek Translation 7.3
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
- 7.2 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
- 7.4 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
- 7.5 lib/oauth-php/library/store/OAuthStorePDO.php \OAuthStorePDO::__construct()
- 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
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');
}
}
}