Class PreparedStatementWrapper

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class PreparedStatementWrapper
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Wraps a PreparedStatement together with the statement text for easier logging when there are errors
    • Constructor Summary

      Constructors 
      Constructor Description
      PreparedStatementWrapper​(java.lang.String statementText, java.sql.PreparedStatement ps)
      Canonical constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.sql.ResultSet executeQuery()
      Convenience method to delegate the call to the wrapped statement
      java.sql.PreparedStatement getPreparedStatement()  
      java.lang.String getStatementText()  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PreparedStatementWrapper

        public PreparedStatementWrapper​(java.lang.String statementText,
                                        java.sql.PreparedStatement ps)
        Canonical constructor
        Parameters:
        statementText -
        ps -
    • Method Detail

      • getStatementText

        public java.lang.String getStatementText()
        Returns:
        the statementText
      • getPreparedStatement

        public java.sql.PreparedStatement getPreparedStatement()
        Returns:
        the preparedStatement
      • close

        public void close()
                   throws java.sql.SQLException
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.sql.SQLException
      • executeQuery

        public java.sql.ResultSet executeQuery()
                                        throws java.sql.SQLException
        Convenience method to delegate the call to the wrapped statement
        Returns:
        Throws:
        java.sql.SQLException