Class Query<ResultType>
java.lang.Object
com.github.tadukoo.database.mysql.transaction.query.Query<ResultType>
- Type Parameters:
ResultType- The type of result returned from the query
- All Implemented Interfaces:
SQLTransaction<ResultType>
Represents a single statement query in MySQL, to be executed as a transaction.
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ResultTypeconvertFromResultSet(ResultSet resultSet) static <ResultType>
Query<ResultType>createQuery(String name, String sql, com.github.tadukoo.util.functional.function.ThrowingFunction<ResultSet, ResultType, SQLException> convertFromResultSet) execute(Connection conn, com.github.tadukoo.util.logger.EasyLogger logger) Executes the transaction using the given connection, and will log messages as needed to the givenEasyLoggerabstract StringgetSQL()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.tadukoo.database.mysql.transaction.SQLTransaction
getTransactionName
-
Constructor Details
-
Query
public Query()
-
-
Method Details
-
getSQL
- Returns:
- The SQL statement to be used for the query
-
execute
public ResultType execute(Connection conn, com.github.tadukoo.util.logger.EasyLogger logger) throws SQLException Executes the transaction using the given connection, and will log messages as needed to the givenEasyLogger- Specified by:
executein interfaceSQLTransaction<ResultType>- Parameters:
conn- TheConnectionto use for the transactionlogger- TheEasyLoggerto use for logging messages as needed- Returns:
- The result of the transaction
- Throws:
SQLException- If anything goes wrong
-
convertFromResultSet
- Parameters:
resultSet- TheResultSetto be converted- Returns:
- The result converted from the
ResultSet - Throws:
SQLException- If something goes wrong during conversion
-
createQuery
public static <ResultType> Query<ResultType> createQuery(String name, String sql, com.github.tadukoo.util.functional.function.ThrowingFunction<ResultSet, ResultType, SQLException> convertFromResultSet)
-