ps.executeUpdate(); if (log.isTraceEnabled()) { log.trace(ps); }
int result = ps.executeUpdate();  if (log.isTraceEnabled()) { log.trace(JDBCUtil.statementToString(sql) + " inserted " + result + " row(s)"); }
   public void store(Message m) throws Exception   {      Connection conn = null;      PreparedStatement ps = null;            TransactionWrapper wrap = new TransactionWrapper();      try      {         conn = ds.getConnection();                     String sql = "INSERT INTO MESSAGE VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";            ps = conn.prepareStatement(sql);         ps.setString(1, (String)m.getMessageID());         ps.setBoolean(2, m.isReliable());         ps.setLong(3, m.getExpiration());         ps.setLong(4, m.getTimestamp());         ps.setObject(5, ((MessageSupport)m).getHeaders());         //stat.setObject(6, m.getPayload());                           /*          * FIXME - Tidy this up          *           * I have changed this for now to serialize the whole message rather than just the payload.          * This is because the message contains hidden protected fields e.g. bodyWriteOnly which          * are part of it's state.          * This can probably be done in a more elegant way          * Just saving the payload and a few fields doesn't persist these fields          * so when they are read back, the state is wrong.          * This has been causing a lot of previouly passing TCK tests to fail.          *           */                  ps.setObject(6, m);            int type = -1;         String jmsType = null;         int priority = -1;         Object correlationID = null;         boolean destIsQueue = false;         String dest = null;         boolean replyToIsQueue = false;         String replyTo = null;         Map jmsProperties = null;            if (m instanceof JBossMessage)         {            JBossMessage jbm = (JBossMessage)m;            type = jbm.getType();            jmsType = jbm.getJMSType();            priority = jbm.getJMSPriority();               // TODO TODO_CORRID            try            {            correlationID = jbm.getJMSCorrelationID();            }            catch(JMSException e)            {               // is this exception really supposed to be thrown?               correlationID = jbm.getJMSCorrelationIDAsBytes();            }               Destination d = jbm.getJMSDestination();            if (d != null)            {               destIsQueue = d instanceof Queue;               if (destIsQueue)               {                  dest = ((Queue)d).getQueueName();               }               else               {                  dest = ((Topic)d).getTopicName();               }            }               Destination r = jbm.getJMSReplyTo();            if (r != null)            {               replyToIsQueue = r instanceof Queue;               if (replyToIsQueue)               {                  replyTo = ((Queue)r).getQueueName();               }               else               {                  replyTo = ((Topic)r).getTopicName();               }            }            jmsProperties = jbm.getJMSProperties();         }            ps.setInt(7, type);         ps.setString(8, jmsType);         ps.setInt(9, priority);         ps.setObject(10, correlationID);         ps.setBoolean(11, destIsQueue);         ps.setString(12, dest);         ps.setBoolean(13, replyToIsQueue);         ps.setString(14, replyTo);         ps.setObject(15, jmsProperties);         ps.executeUpdate();         if (log.isTraceEnabled()) { log.trace(ps); }                  }      catch (SQLException e)      {         wrap.exceptionOccurred();         throw e;      }      finally      {         if (ps != null)         {            try            {               ps.close();            }            catch (Throwable e)            {}         }         if (conn != null)         {            try            {               conn.close();            }            catch (Throwable e)            {}         }         wrap.end();      }         }