Doctrine_Db allows both PEAR-like DSN (data source name) as well as PDO like DSN as constructor parameters.
Getting an instance of Doctrine_Db using PEAR-like DSN:
";
renderCode($str);
?>
Getting an instance of Doctrine_Db using PDO-like DSN (PDO mysql driver):
";
renderCode($str);
?>
Getting an instance of Doctrine_Db using PDO-like DSN (PDO sqlite with memory tables):
";
renderCode($str);
?>
Handling connection errors:
query('SELECT * FROM foo') as \$row) {
print_r(\$row);
}
\$dbh = null;
} catch (PDOException \$e) {
print 'Error!: ' . \$e->getMessage() . '
';
die();
}
?>";
renderCode($str);
?>