library mysql-reconnect
A PDO wrapper that reconnects automatically and re-issues queries on receiving MySQL server timeout errors
fbf/mysql-reconnect
A PDO wrapper that reconnects automatically and re-issues queries on receiving MySQL server timeout errors
- Monday, October 14, 2013
- by neilcrookes
- Repository
- 1 Watchers
- 1 Stars
- 6 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
MySQL-Reconnect
A PDO wrapper that reconnects automatically and re-issues queries on receiving MySQL server timeout errors, (*1)
Usage
$config = array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'mydb',
'user' => 'username',
'pass' => 'password',
);
$db = new Fbf\MysqlReconnect\Db($config);
$sql = "SELECT * FROM posts WHERE id = :id";
$data = array('id' => 1);
$sth = $db->query($sql, $data);
$post = $sth->fetchObj();
How it works
Uses __call() magic method to pass off methods called to the PDO connection object, so you can call whatever you like on $db and it will pass it off to PDO. Inside the magic method we catch timeout exceptions and then reconnect before re-issuing the query., (*2)
dev-master
9999999-dev
A PDO wrapper that reconnects automatically and re-issues queries on receiving MySQL server timeout errors
Sources
Download
MIT
The Requires
v0.1.0
0.1.0.0
A PDO wrapper that reconnects automatically and re-issues queries on receiving MySQL server timeout errors
Sources
Download
MIT
The Requires