Interface DBInterface

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  DBInterface.Transaction
      A transaction represents a sequence of commands that need to be executed as a group, or not at all.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.sql.Connection getConnection()  
      long getSeq​(java.lang.String seqName)
      Gets the next value in a named integer 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.
      java.util.List<java.util.List<java.lang.Object>> runPrepQuery​(java.lang.String query, java.lang.Object... args)
      Runs the given SELECT query as a prepared statement, after setting the arguments in the varargs list.
      int runPrepUpdate​(java.lang.String query, java.io.Serializable... args)
      Runs the given UPDATE/INSERT/DELETE query as a prepared statement, after setting the arguments in the varargs list.
      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.
      java.lang.Object runScalarQuery​(java.lang.String query)
      Runs the given SELECT query, returns the value in the first row of the first column, as its natural type.
      java.lang.Object runTransaction​(DBInterface.Transaction tx)
      Creates a connection, and runs the given transaction.
      int runUpdateQuery​(java.lang.String query)
      Runs the given UPDATE/INSERT/DELETE query, and returns the number of rows affected.
    • Method Detail

      • getConnection

        java.sql.Connection getConnection()
                                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • runScalarQuery

        @Nullable
        java.lang.Object runScalarQuery​(java.lang.String query)
                                 throws java.sql.SQLException
        Runs the given SELECT query, returns the value in the first row of the first column, as its natural type. If no rows are returned, null is returned.
        Throws:
        java.sql.SQLException
      • runQuery

        java.util.List<java.util.List<java.lang.Object>> runQuery​(java.lang.String query)
                                                           throws java.sql.SQLException
        Runs the given SELECT query, and returns the results in a List of Lists of Objects.
        Throws:
        java.sql.SQLException
      • runPrepQuery

        java.util.List<java.util.List<java.lang.Object>> runPrepQuery​(java.lang.String query,
                                                                      java.lang.Object... args)
                                                               throws java.sql.SQLException
        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.
        Throws:
        java.sql.SQLException
      • runUpdateQuery

        int runUpdateQuery​(java.lang.String query)
                    throws java.sql.SQLException
        Runs the given UPDATE/INSERT/DELETE query, and returns the number of rows affected.
        Throws:
        java.sql.SQLException
      • runPrepUpdate

        int runPrepUpdate​(java.lang.String query,
                          java.io.Serializable... args)
                   throws java.sql.SQLException
        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.
        Throws:
        java.sql.SQLException
      • getSeq

        long getSeq​(java.lang.String seqName)
             throws java.sql.SQLException
        Gets the next value in a named integer sequence.
        Throws:
        java.sql.SQLException
      • getSeq

        long getSeq​(java.lang.String seqName,
                    java.sql.Connection connection)
             throws java.sql.SQLException
        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.
        Throws:
        java.sql.SQLException
      • runTransaction

        java.lang.Object runTransaction​(DBInterface.Transaction tx)
                                 throws java.sql.SQLException
        Creates a connection, and runs the given transaction. Transactions need to be serializable.
        Throws:
        java.sql.SQLException