Get a transaction name

@param scalar The name of a transaction;
@param bool Throw exception if we can't find.

@return scalar|false in the event of not found
347291
public function getTransaction( $transaction = self::TRANSACTION_LAST_USED, $throwExceptionIfNotFound = true )
    {

        if( $transaction === self::TRANSACTIONS_ALL ) {
            return array_keys( $this->queue );
        }

        if( $transaction === self::TRANSACTION_LAST_CREATED ) {
            if( !$this->queue) {
                $this->newTransaction();
            }
            $queue = array_keys( $this->queue );
            return array_pop( $queue );
        }

        if( $transaction === self::TRANSACTION_LAST_USED ) {
            if( !$this->queue) {
                $this->newTransaction();
            }
            return $this->lastTransaction;
        }

        if( $transaction === self::TRANSACTION_NEW ) {
            return $this->newTransaction();
        }

        if( !array_key_exists( $transaction, $this->queue ) ) {
            if( $throwExceptionIfNotFound ) {
                throw new TransactionDoesNotExistException(
                    "Transaction with this name `{$transaction}` doesn't exist. Sorry."
                );
            }
            return null;
        }

        return $transaction;

    }
978574
public static function getAccountNameSuffix($type_code)
    {
        switch ($type_code)
        {
            case Account::TYPE_ACCOUNTS_RECEIVABLE: return ' A/R';
            case Account::TYPE_ACCOUNTS_PAYABLE:    return ' A/P';
            case Account::TYPE_SALES:               return ' Sales';
            case Account::TYPE_BANK:                return ' Bank';

            default:

                throw new \Exception('Incorrect type_code: '.$type_code);
        }
    }
449489
public String getTransactionId()
  {
    String tranID = null;
    try
    {
      PersistentTranId pTranID = getSIMPMessage().getTransactionId();
      
      if (pTranID != null)
      {
        tranID = pTranID.toTMString(); 
      }
    }
    catch (SIResourceException e)
    {
      // No FFDC code needed  
      SibTr.exception(tc, e);
    }      

    return tranID;
  }
942534
public static TxInfo getTransactionInfo(Environment env, Bytes prow, Column pcol, long startTs) {
    // TODO ensure primary is visible

    IteratorSetting is = new IteratorSetting(10, RollbackCheckIterator.class);
    RollbackCheckIterator.setLocktime(is, startTs);

    Entry<Key, Value> entry = ColumnUtil.checkColumn(env, is, prow, pcol);

    TxInfo txInfo = new TxInfo();

    if (entry == null) {
      txInfo.status = TxStatus.UNKNOWN;
      return txInfo;
    }

    ColumnType colType = ColumnType.from(entry.getKey());
    long ts = entry.getKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK;

    switch (colType) {
      case LOCK: {
        if (ts == startTs) {
          txInfo.status = TxStatus.LOCKED;
          txInfo.lockValue = entry.getValue().get();
        } else {
          txInfo.status = TxStatus.UNKNOWN; // locked by another tx
        }
        break;
      }
      case DEL_LOCK: {
        DelLockValue dlv = new DelLockValue(entry.getValue().get());

        if (ts != startTs) {
          // expect this to always be false, must be a bug in the iterator
          throw new IllegalStateException(prow + " " + pcol + " (" + ts + " != " + startTs + ") ");
        }

        if (dlv.isRollback()) {
          txInfo.status = TxStatus.ROLLED_BACK;
        } else {
          txInfo.status = TxStatus.COMMITTED;
          txInfo.commitTs = dlv.getCommitTimestamp();
        }
        break;
      }
      case WRITE: {
        long timePtr = WriteValue.getTimestamp(entry.getValue().get());

        if (timePtr != startTs) {
          // expect this to always be false, must be a bug in the iterator
          throw new IllegalStateException(
              prow + " " + pcol + " (" + timePtr + " != " + startTs + ") ");
        }

        txInfo.status = TxStatus.COMMITTED;
        txInfo.commitTs = ts;
        break;
      }
      default:
        throw new IllegalStateException("unexpected col type returned " + colType);
    }

    return txInfo;
  }
632230
@Override
  public final boolean checkIsThereAnyUser() throws Exception {
    if (this.isThereAnyUser) {
      return true;
    }
    String query = "select USERTOMCAT.ITSUSER as ITSUSER, ITSROLE"
      + " from USERTOMCAT join USERROLETOMCAT"
        + " on USERROLETOMCAT.ITSUSER = USERTOMCAT.ITSUSER;";
    boolean result = false;
    IRecordSet<RS> recordSet = null;
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      recordSet = getSrvDatabase().retrieveRecords(query);
      if (recordSet.moveToFirst()) {
        this.isThereAnyUser = true;
        result = true;
      }
      this.srvDatabase.commitTransaction();
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
      if (recordSet != null) {
        recordSet.close();
      }
    }
    return result;
  }
237167
function scalar_symbol( $s = null ){
		$t = $this->t;
		if( !is_null($s) ){
			$this->t = $s;
		}
		return $t;
	}
170182
private static function resolveByDotNotation($dots, $scalar = false)
    {
        # Explode the $def string to array by "."
        $exploded = explode('.', $dots);
        # Initial pointer to array is the private array variable
        $arrPointer = static::$store;

        # Each subsequent dot-value
        foreach ($exploded as $explode) {
            # The value if set, so goto new array pointer
            if ( isset($arrPointer[$explode]) ) {
                $arrPointer = $arrPointer[$explode];
                # Not found the value by dot-notation at given loop run so return null
            } else {
                return null;
            }

            # Finished iterating the array and the value array pointer is pointing to is not another array (except you want a non scalar value)...
            if ( end($exploded) == $explode && ($scalar === false || !is_array($arrPointer)) ) {
                return $arrPointer;
            }
        }
    }
37121
String getAttributeName(Method getter) {
        String attributeName;
        readLockAttrName.lock();
        try {
            attributeName = attributeNameCache.get(getter);
        } finally {
            readLockAttrName.unlock();
        }
        if ( attributeName != null )
            return attributeName;
        DynamoDBHashKey hashKeyAnnotation = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBHashKey.class);
        if ( hashKeyAnnotation != null ) {
            attributeName = hashKeyAnnotation.attributeName();
            if ( attributeName != null && attributeName.length() > 0 )
                return cacheAttributeName(getter, attributeName);
        }
        DynamoDBIndexHashKey indexHashKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBIndexHashKey.class);
        if ( indexHashKey != null ) {
            attributeName = indexHashKey.attributeName();
            if ( attributeName != null && attributeName.length() > 0 )
                return cacheAttributeName(getter, attributeName);
        }
        DynamoDBRangeKey rangeKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBRangeKey.class);
        if ( rangeKey != null ) {
            attributeName = rangeKey.attributeName();
            if ( attributeName != null && attributeName.length() > 0 )
                return cacheAttributeName(getter, attributeName);
        }
        DynamoDBIndexRangeKey indexRangeKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBIndexRangeKey.class);
        if ( indexRangeKey != null ) {
            attributeName = indexRangeKey.attributeName();
            if ( attributeName != null && attributeName.length() > 0 )
                return cacheAttributeName(getter, attributeName);
        }
        DynamoDBAttribute attribute = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBAttribute.class);
        if ( attribute != null ) {
            attributeName = attribute.attributeName();
            if ( attributeName != null && attributeName.length() > 0 )
                return cacheAttributeName(getter, attributeName);
        }
        DynamoDBVersionAttribute version = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBVersionAttribute.class);
        if ( version != null ) {
            attributeName = version.attributeName();
            if ( attributeName != null && attributeName.length() > 0 )
                return cacheAttributeName(getter, attributeName);
        }
        // Default to the camel-cased field name of the getter method, inferred
        // according to the Java naming convention.
        attributeName = ReflectionUtils.getFieldNameByGetter(getter, true);
        return cacheAttributeName(getter, attributeName);
    }
1089900
protected function parseTransactionAccountName()
    {
        $results = [];
        // SEPA MT940 Structured
        if (preg_match('#/NAME/(.+?)\n?/(REMI|ADDR|ISDT|CSID)/#ms', $this->getCurrentTransactionData(), $results)) {
            $accountName = trim($results[1]);
            if (!empty($accountName)) {
                return $this->sanitizeAccountName($accountName);
            }
        }

        if (preg_match('/^:61:.*? (.+)/m', $this->getCurrentTransactionData(), $results)) {
            $accountName = trim($results[1]);
            if (!empty($accountName)) {
                return $this->sanitizeAccountName($accountName);
            }
        }

        if (preg_match('/(.*) Betaalautomaat/', $this->parseTransactionDescription(), $results)) {
            $accountName = trim($results[1]);
            if (!empty($accountName)) {
                return $this->sanitizeAccountName($accountName);
            }
        }
        return '';
    }
1320267
@Nullable
    public ByteIterable get(@NotNull final Transaction txn, @NotNull final ByteIterable first) {
        return this.first.get(txn, first);
    }
1142925
public static function getCurrencyName($currency) {
    return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["currency"] : null;
  }
327578
public ShardingTransactionManager getTransactionManager(final TransactionType transactionType) {
        ShardingTransactionManager result = transactionManagerMap.get(transactionType);
        if (TransactionType.LOCAL != transactionType) {
            Preconditions.checkNotNull(result, "Cannot find transaction manager of [%s]", transactionType);
        }
        return result;
    }
737227
public static function evaluateBinaryScalar($scalar)
    {
        $parsedBinaryData = self::parseScalar(preg_replace('/\s/', '', $scalar));

        if (0 !== (strlen($parsedBinaryData) % 4)) {
            throw new ParseException(sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', strlen($parsedBinaryData)));
        }

        if (!Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) {
            throw new ParseException(sprintf('The base64 encoded data (%s) contains invalid characters.', $parsedBinaryData));
        }

        return base64_decode($parsedBinaryData, true);
    }
1191106
def get_scalar_value(self, name):
        
        if name not in self.scalars:
            raise InvalidServiceConfiguration(
                'Invalid Service Argument Scalar "%s" (not found)' % name
            )
        new_value = self.scalars.get(name)
        return new_value
1071893
public String getName(boolean forcedUpdate) {
		if ((name == null || forcedUpdate) && getRiotApi() != null) {
			try {
				name = getRiotApi().getName(connection.getUser());
			} catch (final IOException e) {
				e.printStackTrace();
			}
		}
		return name;
	}
365195
private String getDatabaseProductName(WSDataSource dataSource) throws Exception {
        String dbProductName = dataSource.getDatabaseProductName();
        if (dbProductName == null) {
            // Query the metadata under a new transaction and commit right away
            LocalTransactionCurrent localTranCurrent = this.localTranCurrent;
            LocalTransactionCoordinator suspendedLTC = localTranCurrent.suspend();
            EmbeddableWebSphereTransactionManager tranMgr = this.tranMgr;
            Transaction suspendedTran = suspendedLTC == null ? tranMgr.suspend() : null;
            boolean tranStarted = false;
            try {
                tranMgr.begin();
                tranStarted = true;
                Connection con = dataSource.getConnection();
                try {
                    dbProductName = con.getMetaData().getDatabaseProductName();
                } finally {
                    con.close();
                }
            } finally {
                try {
                    if (tranStarted)
                        tranMgr.commit();
                } finally {
                    // resume
                    if (suspendedTran != null)
                        tranMgr.resume(suspendedTran);
                    else if (suspendedLTC != null)
                        localTranCurrent.resume(suspendedLTC);
                }
            }
        }
        return dbProductName;
    }
74729
public function newTransaction( $name = null, $updateLastTransaction = true )
    {

        // no name
        if( !isset( $name ) ) {

            $this->queue[] = array();
            $name = $this->getTransaction( self::TRANSACTION_LAST_CREATED );

        // name already taken
        } elseif( array_key_exists( $name, $this->queue ) ) {

            throw new \InvalidArgumentException("Transaction with name `{$name}` already exists can't create new named transaction.");

        // new transaction
        } elseif( !\is_scalar($name) ) {

            throw new \InvalidArgumentException("Transaction name needs to be a scalar." );

        } else {

            $this->queue[$name] = array();

        }

        if( $updateLastTransaction ) {
            $this->lastTransaction = $name;
        }

        return $name;

    }