Find the baseTransaction amongst the results. Because the transactions have been sorted, the next and previous transactions will be the ones on either side of the base transaction
14157
function findPreviousAndNextTransactions(txns, callback) {

    // Find the index in the array of the baseTransaction
    var baseTransactionIndex = _.findIndex(txns, function(possibility) {
      if (possibility.hash === notificationDetails.transaction.hash) {
        return true;
      } else if (possibility.client_resource_id &&
        (possibility.client_resource_id ===
          notificationDetails.transaction.client_resource_id ||
        possibility.client_resource_id === notificationDetails.identifier)) {
        return true;
      }
      return false;
    });

    // The previous transaction is the one with an index in
    // the array of baseTransactionIndex - 1
    if (baseTransactionIndex > 0) {
      var previous_transaction = txns[baseTransactionIndex - 1];
      notificationDetails.previous_transaction_identifier =
        (previous_transaction.from_local_db ?
          previous_transaction.client_resource_id : previous_transaction.hash);
      notificationDetails.previous_hash = previous_transaction.hash;
    }

    // The next transaction is the one with an index in
    // the array of baseTransactionIndex + 1
    if (baseTransactionIndex + 1 < txns.length) {
      var next_transaction = txns[baseTransactionIndex + 1];
      notificationDetails.next_transaction_identifier =
        (next_transaction.from_local_db ?
            next_transaction.client_resource_id : next_transaction.hash);
      notificationDetails.next_hash = next_transaction.hash;
    }

    callback(null, notificationDetails);
  }
878904
def get_transaction_result(
            self,
            transaction: BaseOrSpoofTransaction,
            at_header: BlockHeader) -> bytes:
        
        with self.get_vm(at_header).state_in_temp_block() as state:
            computation = state.costless_execute_transaction(transaction)

        computation.raise_if_error()
        return computation.output
961677
public function beginTransaction()
    {
        $return = true;
        if (!$this->nestedTransactionCount) {
            $return = parent::beginTransaction();
            if ($this->useDebug) {
                $this->log('Begin transaction', null, __METHOD__);
            }
            $this->isUncommitable = false;
        }
        $this->nestedTransactionCount++;

        return $return;
    }
600706
function(transaction, results) {
    if (ydn.db.core.req.CachedWebsqlCursor.DEBUG) {
      goog.global.console.log([sql, results]);
    }
    me.has_pending_request = false;
    me.cursor_ = results;
    me.current_cursor_index_ = 0;
    if (!!me.index_name && goog.isDefAndNotNull(ini_key)) {
      // skip them
      var cmp = ydn.db.cmp(me.getPrimaryKey(), ini_key);
      while (cmp == -1 || (cmp == 0 && exclusive)) {
        me.current_cursor_index_++;
        cmp = ydn.db.cmp(me.getPrimaryKey(), ini_key);
      }
    }
    me.onSuccess(me.getPrimaryKey(), me.getIndexKey(), me.getValue());
  }
379598
def get_transaction_isolation(self):
        
        if self._transaction_isolation_level is None:
            self._transaction_isolation_level = self._platform.get_default_transaction_isolation_level()
        return self._transaction_isolation_level
561243
public function beginTransaction()
    {
        $return = true;
        $opcount = $this->getNestedTransactionCount();
        if ($opcount === 0) {
            $return = self::exec('BEGIN TRANSACTION');
            if ($this->useDebug) {
                $this->log('Begin transaction', null, __METHOD__);
            }
            $this->isUncommitable = false;
        }
        $this->nestedTransactionCount++;

        return $return;
    }
1117981
@Override
    public OrderableTransaction poll() {
        OrderableTransaction retval = null;
        updateQueueState();
        if (m_state == QueueState.UNBLOCKED) {
            retval = super.peek();
            super.poll();
            // not BLOCKED_EMPTY
            assert(retval != null);
        }
        return retval;
    }
158747
def get_transaction(txhash)
      blockhash, tx_num_enc = RLP.decode @db.get(txhash)
      blk = RLP.decode(@db.get(blockhash), sedes: Block, env: @env)

      num = Utils.decode_int tx_num_enc
      tx_data = blk.get_transaction num

      [tx_data, blk, num]
    end
324330
private Transaction getAndValidateWrappedTransaction() throws IllegalStateException {
		final Transaction wrappedTransaction = getWrappedTransaction();
		if (wrappedTransaction == null) {
			throw new IllegalStateException();
		}
		else { 
			return wrappedTransaction;
		}
	}
649958
def transactions(self) -> TransactionsAggregate:
        
        if not self.__transactions_aggregate:
            self.__transactions_aggregate = TransactionsAggregate(self.book)
        return self.__transactions_aggregate
192019
private Transaction onBegin()
    {
        Transaction tx;
        if (((StatelessSessionImpl) s).getTransactionCoordinator().isTransactionActive())
        {
            tx = ((StatelessSessionImpl) s).getTransaction();
        }
        else
        {
            tx = s.beginTransaction();
        }
        return tx;
    }
1091473
private function afterTransactionRolledBack()
    {
        if ( ! $this->hasCache) {
            return;
        }

        foreach ($this->persisters as $persister) {
            if ($persister instanceof CachedPersister) {
                $persister->afterTransactionRolledBack();
            }
        }

        foreach ($this->collectionPersisters as $persister) {
            if ($persister instanceof CachedPersister) {
                $persister->afterTransactionRolledBack();
            }
        }
    }
748187
private static final Object getCurrentUOWCoord() {
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(TRACE, "getCurrentUOWCoord");
        }

        Object currentUOW = null;
        if (isRunningInWAS()) {
            currentUOW = EmbeddableTransactionManagerFactory.getUOWCurrent().getUOWCoord();
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(TRACE, "getCurrentUOWCoord", currentUOW);
        }
        return currentUOW;
    }
1019259
protected SITransaction getTransaction() {

        if (TRACE.isEntryEnabled()) {
            final String methodName = "getTransaction";
            SibTr.entry(this, TRACE, methodName);
            SibTr.exit(this, TRACE, methodName, null);
        }
        return null;

    }
180691
protected void prepareTransactionMemoriesIfExists() {
        final SavedTransactionMemories memories = ThreadCacheContext.findTransactionMemories();
        if (memories != null) {
            final List<TransactionMemoriesProvider> providerList = memories.getOrderedProviderList();
            final StringBuilder sb = new StringBuilder();
            for (TransactionMemoriesProvider provider : providerList) {
                provider.provide().ifPresent(result -> sb.append("\n*").append(result));
            }
            final WholeShowAttribute attribute = new WholeShowAttribute(sb.toString().trim());
            requestManager.setAttribute(LastaWebKey.DBFLUTE_TRANSACTION_MEMORIES_KEY, attribute);
        }
    }
4323
def get_amount_arrears_transactions(self, billing_cycle):
        """"""
        previous_billing_cycle = billing_cycle.get_previous()
        if not previous_billing_cycle:
            return Decimal(0)
        return self.to_account.balance(
            transaction__date__lt=previous_billing_cycle.date_range.upper,
            transaction__date__gte=previous_billing_cycle.date_range.lower,
        )
574264
def ddl_transaction(&block)
        if Base.connection.supports_ddl_transactions?
          Base.transaction { block.call }
        else
          block.call
        end
      end