Package org.assertj.db.type
Class Request
- All Implemented Interfaces:
DbElement,WithColumnLetterCase,WithLetterCase,WithPrimaryKeyLetterCase,WithTableLetterCase
A request in the database to get values.
The different information of the request are the SQL request and optionally the parameters of the SQL request.
A Request should be constructed by the fluent builder Request.Builder from a AssertDbConnection instance.
Examples of instantiation :
-
This
Requestpoint to a request without parameter in a H2 database in memory.AssertDbConnection connection = AssertDbConnectionFactory.of("jdbc:h2:mem:test", "sa", "").create(); Request request = connection.request("select title from movie;").build(); -
Below the
Requestpoint to a request with2000in parameter.
TheAssertDbConnectionuse aDataSourceinstead of a JDBC url like above.DataSource dataSource = ...; AssertDbConnection connection = AssertDbConnectionFactory.of(dataSource).create(); Request request = connection.request("select title from movie where year > ?;").parameters(2000).build();
- Author:
- Régis Pouiller, Julien Roy
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.assertj.db.type.AbstractDbElement
myself -
Method Summary
Modifier and TypeMethodDescriptionObject[]The parameters of the SQL request.Returns the SQL request.protected voidloadImpl(Connection connection) Specific implementation of the loading for aRequest.Methods inherited from class org.assertj.db.type.AbstractDbData
collectRowsFromResultSet, controlIfAllThePksNameExistInTheColumns, getColumn, getColumnsList, getColumnsNameList, getDataType, getPksNameList, getRow, getRowFromPksValues, getRowsList, setColumnsNameList, setPksNameList, sortRowsMethods inherited from class org.assertj.db.type.AbstractDbElement
getColumnLetterCase, getConnection, getConnectionProvider, getMetaData, getPrimaryKeyLetterCase, getTableLetterCase
-
Method Details
-
getRequest
Returns the SQL request.- Specified by:
getRequestin classAbstractDbData<Request>- Returns:
- The SQL request.
- See Also:
-
getParameters
The parameters of the SQL request.- Returns:
- The SQL request.
-
loadImpl
Specific implementation of the loading for aRequest.- Specified by:
loadImplin classAbstractDbData<Request>- Parameters:
connection-Connectionto the database provided byAbstractDbData.load()private method.- Throws:
NullPointerException- If therequestfield isnull.SQLException- SQL Exception.- See Also:
-