Package com.iizix.server.db
Class DBFunctions
java.lang.Object
com.iizix.server.db.DBFunctions
Database functions are placed in this class.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescription<RESULT> RESULT
execute
(DBOperation<RESULT> op) Executes a method using a functional interface, grabbing a connection from the connection pool.<RESULT> RESULT
execute
(Connection conn, DBOperation<RESULT> op) Executes a method using a functional interface using a connection.<RESULT,
PARAM>
RESULTexecute
(Connection conn, PARAM param, DBOperationParam<RESULT, PARAM> op) Executes a method using a functional interface using a connection.<RESULT,
PARAM>
RESULTexecute
(PARAM param, DBOperationParam<RESULT, PARAM> op) Executes a method using a functional interface, grabbing a connection from the connection pool.static DBFunctions
Gets the DBFunctions instance.
Method Details
getInstance
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, NotFoundExceptionExecutes a method using a functional interface using a connection.- Type Parameters:
PARAM
- The parameter for the database operation.RESULT
- The return value.- 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
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, NotFoundExceptionExecutes a method using a functional interface, grabbing a connection from the connection pool.- Type Parameters:
PARAM
- The parameter for the database operation.RESULT
- The return value.- 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.