private static function checkAutocommit(\PDO $pdo)
{
$vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
// MySQL turns autocommit off during a transaction.
if ($vendor == "mysql") {
return;
}
try {
if ($pdo->getAttribute(\PDO::ATTR_AUTOCOMMIT)) {
throw new \InvalidArgumentException("PDO::ATTR_AUTOCOMMIT should be disabled.");
}
} catch (\PDOException $e) {
/*
* Ignore this, as some drivers would throw an exception for an
* unsupported attribute (e.g. Postgres).
*/
}
}