shabbyrobe / pdok Goto Github PK
View Code? Open in Web Editor NEWJust like PDO, but with fewer annoyances
Just like PDO, but with fewer annoyances
PDOK should provide an option to handle "MySQL server has gone away".
Discussion started here: shabbyrobe/amiss#21
Fix supplied by @dig412:
const MYSQL_SERVER_GONE_ERROR = 2006;
//..snip...
try {
return call_user_func_array(array($pdo, 'query'), $args);
} catch (\PDOException $e) {
$mysqlErrorCode = isset($e->errorInfo[1]) ? (int) $e->errorInfo[1] : null;
switch ($mysqlErrorCode) {
case self::MYSQL_SERVER_GONE_ERROR:
//Catch "server has gone away" error, reconnect and retry.
//Even though the error mode is set to "Exception", pdo will log an error
//See https://bugs.php.net/bug.php?id=63812
$this->disconnect();
$this->connect();
return call_user_func_array(array($this, 'query'), $args);
break;
default:
throw $e;
break;
}
}
I'd like to establish some tests around the failure modes before I include this in there, which will be pretty tricky to do but I need to be certain that it's totally impossible for non-idempotent queries to double up. Have you ever seen such a thing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.