if (log.isTraceEnabled()) { log.trace(selectTransactionId + (ltxID == Long.MIN_VALUE ? " failed!" : " returned " + txID)); }
if (trace) { log.trace(selectTransactionId + (ltxID == Long.MIN_VALUE ? " failed!" : " returned " + txID)); }
   protected void addTXRecord(Connection conn, Transaction tx) throws Exception   {      if (log.isTraceEnabled()) { log.trace("logging " + tx);}      PreparedStatement ps = null;      String statement = "UNDEFINED";      ResultSet rs = null;      boolean xa = false;      int rows = -1;      int formatID = -1;      String txID = null;      try      {         xa = storeXid && tx.getXid() != null;         statement = xa ? insertTransactionXA : insertTransaction;         ps = conn.prepareStatement(statement);                  if (txIdGUID)         {            txID = new GUID().toString();            tx.setGuidTxID(txID);            ps.setString(1, txID);         }         else         {            // the TRANSACTIONID field is created as IDENTITY so inserting null here is acceptable            ps.setNull(1, Types.BIGINT);         }                  if (xa)         {            Xid xid = tx.getXid();            formatID = xid.getFormatId();            this.setBytes(ps, 2, xid.getBranchQualifier());            ps.setInt(3, formatID);            this.setBytes(ps, 4, xid.getGlobalTransactionId());         }         rows = ps.executeUpdate();                  if (!txIdGUID)         {            long ltxID = Long.MIN_VALUE;            try            {               ps.close();               ps = conn.prepareStatement(selectTransactionId);               rs = ps.executeQuery();               rs.next();               ltxID = rs.getLong(1);               tx.setLongTxId(ltxID);            }            finally            {               if (log.isTraceEnabled()) { log.trace(selectTransactionId + (ltxID == Long.MIN_VALUE ? " failed!" : " returned " + txID)); }            }         }      }      finally      {         if (log.isTraceEnabled())         {            String s = insertTransaction.equals(statement) ?               JDBCUtil.statementToString(insertTransaction, txID) :               JDBCUtil.statementToString(insertTransactionXA, getTxId(tx), "<byte-array>", new Integer(formatID), "<byte-array>");            log.trace(s + (rows == -1 ? " failed!" : " inserted " + rows + " row(s)"));         }         try         {            if (rs != null)            {               rs.close();            }            if (ps != null)            {               ps.close();            }         }         catch (Throwable e)         {            //Ignore         }      }   }