public function beginTransaction(?string $savepoint = null): self
    {
        if (null === $savepoint) {
            if (!$this->inTransaction()) {
                $this->execute('BEGIN');
            }

        } elseif (!$this->inTransaction()) {
            throw new exceptions\RuntimeException(
                __METHOD__ . ': Savepoints can only be used in transaction blocks'
            );

        } else {
            $this->execute('SAVEPOINT ' . $savepoint);
        }

        return $this;
    }