Class AbstractDBInterface

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.sql.Connection getConnection()  
      long getSeq​(java.lang.String seqName)
      Gets the next value in a sequence.
      long getSeq​(java.lang.String seqName, java.sql.Connection connection)
      Like the other getSeq, but operates against a particular local db connection, which may be necessary if the sequence generation is part of a transaction.
      static java.util.List<java.util.List<java.lang.Object>> resultSetToListNatural​(java.sql.ResultSet rs)  
      java.util.List<java.util.List<java.lang.Object>> runPrepQuery​(java.lang.String stmt, java.lang.Object... args)
      Runs the given SELECT query as a prepared statement, after setting the arguments in the varargs list.
      static java.util.List<java.util.List<java.lang.Object>> runPrepQuery​(java.sql.Connection con, java.lang.String stmt, java.lang.Object... args)  
      int runPrepUpdate​(java.lang.String stmt, java.io.Serializable... args)
      Runs the given UPDATE/INSERT/DELETE query as a prepared statement, after setting the arguments in the varargs list.
      static int runPrepUpdate​(java.sql.Connection con, java.lang.String stmt, java.io.Serializable... args)  
      java.util.List<java.util.List<java.lang.Object>> runQuery​(java.lang.String query)
      Runs the given SELECT query, and returns the results in a List of Lists of Objects.
      static java.util.List<java.util.List<java.lang.Object>> runQuery​(java.sql.Connection con, java.lang.String query)  
      java.lang.Object runScalarQuery​(java.lang.String query)
      Runs the given query.
      java.lang.Object runTransaction​(DBInterface.Transaction tx)
      Runs the given transaction with a new connection.
      int runUpdateQuery​(java.lang.String query)
      Runs the given update query, and returns the number of rows affected.
      static int runUpdateQuery​(java.sql.Connection con, java.lang.String query)  
      protected boolean shouldCloseConnection()  
      • Methods inherited from class java.lang.Object

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

      • AbstractDBInterface

        public AbstractDBInterface()
    • Method Detail

      • getConnection

        public abstract java.sql.Connection getConnection()
                                                   throws java.sql.SQLException
        Specified by:
        getConnection in interface DBInterface
        Throws:
        java.sql.SQLException
      • shouldCloseConnection

        protected boolean shouldCloseConnection()
      • resultSetToListNatural

        public static java.util.List<java.util.List<java.lang.Object>> resultSetToListNatural​(java.sql.ResultSet rs)
                                                                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getSeq

        public long getSeq​(java.lang.String seqName)
                    throws java.sql.SQLException
        Gets the next value in a sequence.
        Specified by:
        getSeq in interface DBInterface
        Throws:
        java.sql.SQLException
      • getSeq

        public long getSeq​(java.lang.String seqName,
                           java.sql.Connection connection)
                    throws java.sql.SQLException
        Description copied from interface: DBInterface
        Like the other getSeq, but operates against a particular local db connection, which may be necessary if the sequence generation is part of a transaction.
        Specified by:
        getSeq in interface DBInterface
        Throws:
        java.sql.SQLException
      • runPrepQuery

        public static java.util.List<java.util.List<java.lang.Object>> runPrepQuery​(java.sql.Connection con,
                                                                                    java.lang.String stmt,
                                                                                    java.lang.Object... args)
                                                                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • runPrepQuery

        public java.util.List<java.util.List<java.lang.Object>> runPrepQuery​(java.lang.String stmt,
                                                                             java.lang.Object... args)
                                                                      throws java.sql.SQLException
        Description copied from interface: DBInterface
        Runs the given SELECT query as a prepared statement, after setting the arguments in the varargs list. Returns the results in a List of Lists of Objects.
        Specified by:
        runPrepQuery in interface DBInterface
        Throws:
        java.sql.SQLException
      • runPrepUpdate

        public static int runPrepUpdate​(java.sql.Connection con,
                                        java.lang.String stmt,
                                        java.io.Serializable... args)
                                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • runPrepUpdate

        public int runPrepUpdate​(java.lang.String stmt,
                                 java.io.Serializable... args)
                          throws java.sql.SQLException
        Description copied from interface: DBInterface
        Runs the given UPDATE/INSERT/DELETE query as a prepared statement, after setting the arguments in the varargs list. Returns the number of rows affected.
        Specified by:
        runPrepUpdate in interface DBInterface
        Throws:
        java.sql.SQLException
      • runQuery

        public static java.util.List<java.util.List<java.lang.Object>> runQuery​(java.sql.Connection con,
                                                                                java.lang.String query)
                                                                         throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • runQuery

        public java.util.List<java.util.List<java.lang.Object>> runQuery​(java.lang.String query)
                                                                  throws java.sql.SQLException
        Description copied from interface: DBInterface
        Runs the given SELECT query, and returns the results in a List of Lists of Objects.
        Specified by:
        runQuery in interface DBInterface
        Throws:
        java.sql.SQLException
      • runScalarQuery

        public java.lang.Object runScalarQuery​(java.lang.String query)
                                        throws java.sql.SQLException
        Runs the given query. Returns null if no rows are returned, or the value at row 1 column 1 as a string if rows are returned.
        Specified by:
        runScalarQuery in interface DBInterface
        Throws:
        java.sql.SQLException
      • runTransaction

        public java.lang.Object runTransaction​(DBInterface.Transaction tx)
                                        throws java.sql.SQLException
        Runs the given transaction with a new connection. Closes the connection if the transaction doesn't do it.
        Specified by:
        runTransaction in interface DBInterface
        Throws:
        java.sql.SQLException
      • runUpdateQuery

        public static int runUpdateQuery​(java.sql.Connection con,
                                         java.lang.String query)
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • runUpdateQuery

        public int runUpdateQuery​(java.lang.String query)
                           throws java.sql.SQLException
        Runs the given update query, and returns the number of rows affected.
        Specified by:
        runUpdateQuery in interface DBInterface
        Throws:
        java.sql.SQLException