public function startTransaction()
    {
        # Ensure we have a connection to start the transaction on
        $this->connect();

        switch ($this->mode) {

            case "mysql":
                $result = $this->server->autocommit(false);
                break;

            case "postgres":
                $result = $this->query("SET AUTOCOMMIT = OFF");
                break;

            case "redshift":
                $result = $this->query("START TRANSACTION");
                break;

            case "odbc":
                $result = odbc_autocommit($this->server, false);
                break;

            default:
                throw new \Exception("startTransaction() not supported in this mode (" . $this->mode . ")");
        }

        if (!$result) {
            $this->error();
        }

        $this->transaction = true;

        return true;
    }