Close this transaction, triggering either a COMMIT or a ROLLBACK,
        depending on the value of :attr:`.success`.

        :raise TransactionError: if already closed
161516
def close(self):
        
        from neobolt.exceptions import CypherError
        self._assert_open()
        try:
            self.sync()
        except CypherError:
            self.success = False
            raise
        finally:
            if self.session.has_transaction():
                if self.success:
                    self.session.commit_transaction()
                else:
                    self.session.rollback_transaction()
            self._closed = True
            self.on_close()
771121
def rollback(self):
        
        try:
            if self._autocommit:
                return

            if not self._conn or not self._conn.is_connected():
                return

            if not self._conn.tds72_transaction:
                return

            self._main_cursor._rollback(cont=True,
                                        isolation_level=self._isolation_level)
        except socket.error as e:
            if e.errno in (errno.ENETRESET, errno.ECONNRESET, errno.EPIPE):
                return
            self._conn.close()
            raise
        except ClosedConnectionError:
            pass
911627
def close(self):
        
        if callable(getattr(self._file, 'close', None)):
            self._iterator.close()
        self._iterator = None
        self._unconsumed = None
        self.closed = True
1255402
def leave_transaction_management(self) -> None:
        
        if len(self._transactions) == 0:
            raise RuntimeError("leave_transaction_management called outside transaction")
        elif len(self._transactions[-1]) > 0:
            raise RuntimeError("leave_transaction_management called with uncommited rollbacks")
        else:
            self._transactions.pop()
325215
def transaction_commit(self, transaction_id, **kwargs):
        
        if transaction_id not in self.__transactions:
            raise workflows.Error("Attempting to commit unknown transaction")
        self.log.debug("Committing transaction %s", transaction_id)
        self.__transactions.remove(transaction_id)
        self._transaction_commit(transaction_id, **kwargs)
284961
def commit(self) -> None:
        
        if len(self._transactions) == 0:
            raise RuntimeError("commit called outside transaction")

        # If we have nested transactions, we don't actually commit, but push
        # rollbacks up to previous transaction.
        if len(self._transactions) > 1:
            for on_rollback in reversed(self._transactions[-1]):
                self._transactions[-2].insert(0, on_rollback)

        _debug("commit")
        self.reset()
813641
def close_db(self, exception):
        """"""
        if self.is_connected:
            if exception is None and not transaction.isDoomed():
                transaction.commit()
            else:
                transaction.abort()
            self.connection.close()
794026
def close(self):
        
        LOGGER.debug('Connection %s closing', self.id)
        if self.busy:
            raise ConnectionBusyError(self)
        with self._lock:
            if not self.handle.closed:
                try:
                    self.handle.close()
                except psycopg2.InterfaceError as error:
                    LOGGER.error('Error closing socket: %s', error)
538544
def rollback(using=None, sid=None):
    
    if sid:
        django.db.transaction.savepoint_rollback(sid)
    else:
        try:
             django.db.transaction.rollback(using)
        except django.db.transaction.TransactionManagementError:
             django.db.transaction.set_rollback(True, using)
1109474
def transaction_abort(self, transaction_id, **kwargs):
        
        if transaction_id not in self.__transactions:
            raise workflows.Error("Attempting to abort unknown transaction")
        self.log.debug("Aborting transaction %s", transaction_id)
        self.__transactions.remove(transaction_id)
        self._transaction_abort(transaction_id, **kwargs)
1326670
def begin(self):
        
        if self._transaction_id is not None:
            raise ValueError("Transaction already begun")

        if self.committed is not None:
            raise ValueError("Transaction already committed")

        if self._rolled_back:
            raise ValueError("Transaction is already rolled back")

        database = self._session._database
        api = database.spanner_api
        metadata = _metadata_with_prefix(database.name)
        txn_options = TransactionOptions(read_write=TransactionOptions.ReadWrite())
        response = api.begin_transaction(
            self._session.name, txn_options, metadata=metadata
        )
        self._transaction_id = response.id
        return self._transaction_id
230058
def close( self ):
        
        if self.db is not None:
            self.db.commit()
            self.db.close()
            self.db = None

        return
1062800
def release(self, lock_transactions=None):
        

        self.personal_lock.release()

        self.with_count -= 1

        if lock_transactions is None:
            lock_transactions = self.lock_transactions

        if not lock_transactions:
            self.db_state.lock.release()
            return

        try:
            # If the connection is closed, an exception is thrown
            in_transaction = self.in_transaction
        except sqlite3.ProgrammingError:
            in_transaction = False

        # The transaction lock should be released only if:
        # 1) the connection was previously in a transaction and now it isn't
        # 2) the connection wasn't previously in a transaction and still isn't
        if (self.was_in_transaction and not in_transaction) or not in_transaction:
            if self.with_count == 0: # This is for nested with statements
                self.db_state.active_connection = None
                self.db_state.transaction_lock.release()

        self.db_state.lock.release()
1344488
def rollback_transaction(self):
        
        self._assert_open()
        if not self._transaction:
            raise TransactionError("No transaction to rollback")
        cx = self._connection
        if cx:
            metadata = {}
            try:
                cx.rollback(on_success=metadata.update)
            finally:
                self._disconnect(sync=True)
                self._transaction = None
528627
def close(self):
        
        if not self._closed:
            self.__flush()
            object.__setattr__(self, "_closed", True)
474214
def execute_closing_transaction(statements: Iterable):
    """"""

    with closing(connect()) as conn:
        with conn.cursor() as cursor:
            for statement in statements:
                cursor.execute(statement)
37309
def close(self):
        
        if self._closed:
            return defer.succeed(None)

        def ok(_):
            self._closed = True
        return self.__flush().addCallback(ok)