Well I tried getAttribute and got an error:
<?php
$dsn = "mysql:host=localhost;dbname=chump";
$user = "foo";
$pass = "bar";
try {
$pdo = new PDO($dsn, $user, $pass);
echo "success\n";
$to = $pdo->getAttribute(PDO::ATTR_TIMEOUT);
echo "timeout $to\n";
} catch (Exception $e) {
die("Exception:" . $e->getMessage());
}
?>
The error:
PHP Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/jaith/biz/valunite/ImageDaemon/chump.php on line 11
PHP Stack trace:
PHP 1. {main}() /home/jaith/biz/valunite/ImageDaemon/chump.php:0
PHP 2. PDO->getAttribute() /home/jaith/biz/valunite/ImageDaemon/chump.php:11
I suppose that's what the docs mean by "Note that some database/driver combinations may not support all of the database connection attributes. "
And, somewhat curiously, this script works, simply outputting "success\n"
$dsn = "mysql:host=localhost;dbname=chump";
$user = "foo";
$pass = "bar";
try {
$pdo = new PDO($dsn, $user, $pass);
$pdo->setAttribute(PDO::ATTR_TIMEOUT, 300);
echo "success\n";
} catch (Exception $e) {
die("Exception:" . $e->getMessage());
}
:queasy: