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
-
Method Summary
Modifier and TypeMethodDescriptionabstract ResultType
convertFromResultSet
(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 givenEasyLogger
abstract String
getSQL()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
execute
in interfaceSQLTransaction<ResultType>
- Parameters:
conn
- TheConnection
to use for the transactionlogger
- TheEasyLogger
to use for logging messages as needed- Returns:
- The result of the transaction
- Throws:
SQLException
- If anything goes wrong
-
convertFromResultSet
- Parameters:
resultSet
- TheResultSet
to 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)
-