Commit and close the DB session associated with this task (no error is raised if None is open)

        Args:
            commit (bool): commit session before closing (default=True)
514402
def close_session(self, commit=True):
        
        if self._session is not None:
            if commit:
                self._session.commit()
            self._session.close()
            self._session = None
633149
def commit(cls):
        
        cls.objects.deleted().true_delete()
        cls.objects.changed().true_update(_new=False, _changed=False)
1206255
private void commitPrepared(Xid xid) throws XAException {
    try {
      // Check preconditions. The connection mustn't be used for another
      // other XA or local transaction, or the COMMIT PREPARED command
      // would mess it up.
      if (state != STATE_IDLE || conn.getTransaction().hasBufferedMutations()) {
        throw new CloudSpannerXAException(CloudSpannerXAException.TWO_PHASE_IDLE,
            Code.FAILED_PRECONDITION, XAException.XAER_RMERR);
      }

      String s = RecoveredXid.xidToString(xid);

      localAutoCommitMode = conn.getAutoCommit();
      conn.setAutoCommit(true);
      try {
        conn.commitPreparedTransaction(s);
      } finally {
        conn.setAutoCommit(localAutoCommitMode);
      }
    } catch (CloudSpannerSQLException ex) {
      throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_COMMIT_PREPARED, ex,
          XAException.XAER_RMERR);
    } catch (SQLException ex) {
      throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_COMMIT_PREPARED, ex,
          Code.UNKNOWN, XAException.XAER_RMERR);
    }
  }
443752
def commit(self):
        """"""
        try:
            self._con.commit()
            self._con.autocommit(True)
        except Exception as e:
            try:
                self._con.rollback()
            except Exception as e_:
                LOGGER.error('When transaction happend error: %s', e_)
            raise e
        finally:
            self._db.pool.push(self._con)
            self._con = None
            self._db = None
414981
def commit_transaction(self):
        
        self._assert_open()
        if not self._transaction:
            raise TransactionError("No transaction to commit")
        metadata = {}
        try:
            self._connection.commit(on_success=metadata.update)
        finally:
            self._disconnect(sync=True)
            self._transaction = None
        bookmark = metadata.get("bookmark")
        self._bookmarks_in = tuple([bookmark])
        self._bookmark_out = bookmark
        return bookmark
642135
def commit(self):
        

        if not self._parent._is_active:
            raise exc.InvalidRequestError("This transaction is inactive")
        yield from self._do_commit()
        self._is_active = False
1312970
def delete(self, *, auto_commit=False):
        
        try:
            db.session.delete(self.resource)
            if auto_commit:
                db.session.commit()
        except SQLAlchemyError:
            self.log.exception('Failed deleting resource: {}'.format(self.id))
            db.session.rollback()
78099
protected function commit_transaction() {
        if (!$this->transactions_supported()) {
            return;
        }

        $sql = "COMMIT";
        $this->query_start($sql, NULL, SQL_QUERY_AUX);
        $result = $this->mysqli->query($sql);
        $this->query_end($result);
    }
577536
static boolean closeQuietlyIfAutoCommit(Connection connection) {
        try {
            if (connection != null && !connection.isClosed() && connection.getAutoCommit()) {
                closeQuietly(connection);
                return true;
            } else
                return false;
        } catch (SQLException e) {
            throw new SQLRuntimeException(e);
        }
    }
431980
def save(self):
        
        try:
            if self.exists() is False:
                self.db.session.add(self)
            # self.db.session.merge(self)
            self.db.session.commit()
        except (Exception, BaseException) as error:
            if current_app.config['DEBUG']:
                raise error
            return None
558916
def session(self):
        
        engine = self.engine
        connection = engine.connect()
        db_session = scoped_session(
            sessionmaker(autocommit=False, autoflush=True, bind=engine))
        yield db_session
        db_session.close()
        connection.close()
527579
def save(self, commit=False):
        
        if not has_identity(self):
            # Object has not been persisted to the database.
            session.add(self)

        if commit:
            # Commit the session as requested.
            session.commit()

        else:
            # Just flush the session; do not commit.
            session.flush()
808481
def batch_commit(self, *, do_deletes=False):
        '''
        
        '''
        try:
            yield
        except Exception as exc:
            raise exc
        else:
            for key, value in self.cache.items():
                if value is not DELETED:
                    self.wrapped_db[key] = value
                elif do_deletes:
                    self.wrapped_db.pop(key, None)
                # if do_deletes is False, ignore deletes to underlying db
        finally:
            self.cache = {}
1061509
def commit(self, cascade=False):
        
        logger.debug('Committing Dagobah instance with cascade={0}'.format(cascade))
        self.backend.commit_dagobah(self._serialize())
        if cascade:
            [job.commit() for job in self.jobs]
458267
def commit(self):
        """"""
        self.flush()
        if hasattr(self, 'transaction') and self.transaction.is_active:
            self.transaction.commit()
        elif hasattr(self, 'connection'):
            self.connection.commit()
649670
@SuppressWarnings("unchecked")
  private void commit() {
    long index = this.currentIndex;
    for (RaftSession session : sessions.getSessions(primitiveId)) {
      session.commit(index);
    }
  }
285764
def commit(self):
        
        with self.native(writeAccess=True) as conn:
            if not self._closed(conn):
                return self._commit(conn)