malkusch\lock\mutex\TransactionalMutex::checkAutocommit PHP Method

checkAutocommit() private static method

Checks that the AUTOCOMMIT mode is turned off.
private static checkAutocommit ( PDO $pdo )
$pdo PDO PDO
    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).
             */
        }
    }