Class DBFunctions

java.lang.Object
com.iizix.server.db.DBFunctions

public class DBFunctions extends Object
Database functions are placed in this class.
Author:
Christopher Mindus
  • Method Details

    • getInstance

      public static DBFunctions getInstance() throws SQLException
      Gets the DBFunctions instance.
      Returns:
      The DBFunctions instance.
      Throws:
      SQLException - For connection, class loader or instantiation failures.
      SecurityException - When access is denied.
    • execute

      public <RESULT> RESULT execute(Connection conn, DBOperation<RESULT> op) throws SQLException, NotFoundException
      Executes a method using a functional interface using a connection.
      Type Parameters:
      RESULT - The return value.
      Parameters:
      conn - The connection.
      Returns:
      The result.
      Throws:
      NotFoundException - When searched element is not found.
      SQLException - For SQL errors in getting the Connection as well as executing the SQL.
      ClassCastException - When parameters are not well defined.
    • execute

      public <RESULT, PARAM> RESULT execute(Connection conn, PARAM param, DBOperationParam<RESULT,PARAM> op) throws SQLException, NotFoundException
      Executes a method using a functional interface using a connection.
      Type Parameters:
      RESULT - The return value.
      PARAM - The parameter for the database operation.
      Parameters:
      conn - The connection.
      param - The parameter.
      Returns:
      The result.
      Throws:
      NotFoundException - When searched element is not found.
      SQLException - For SQL errors in getting the Connection as well as executing the SQL.
      ClassCastException - When parameters are not well defined.
    • execute

      public <RESULT> RESULT execute(DBOperation<RESULT> op) throws SQLException, NotFoundException
      Executes a method using a functional interface, grabbing a connection from the connection pool.
      Type Parameters:
      RESULT - The return value.
      Returns:
      The result.
      Throws:
      NotFoundException - When searched element is not found.
      SQLException - For SQL errors in getting the Connection as well as executing the SQL.
      ClassCastException - When parameters are not well defined.
    • execute

      public <RESULT, PARAM> RESULT execute(PARAM param, DBOperationParam<RESULT,PARAM> op) throws SQLException, NotFoundException
      Executes a method using a functional interface, grabbing a connection from the connection pool.
      Type Parameters:
      RESULT - The return value.
      PARAM - The parameter for the database operation.
      Parameters:
      param - The parameter.
      Returns:
      The result.
      Throws:
      NotFoundException - When searched element is not found.
      SQLException - For SQL errors in getting the Connection as well as executing the SQL.
      ClassCastException - When parameters are not well defined.