Package io.vertigo.database.sql
Interface SqlManager
-
- All Superinterfaces:
io.vertigo.core.node.component.Component
,io.vertigo.core.node.component.CoreComponent
,io.vertigo.core.node.component.Manager
- All Known Implementing Classes:
SqlManagerImpl
public interface SqlManager extends io.vertigo.core.node.component.Manager
Manages connections to database.- Author:
- pchretien
-
-
Field Summary
Fields Modifier and Type Field Description static String
MAIN_CONNECTION_PROVIDER_NAME
The name of the main connectionProvider.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OptionalInt
executeBatch(SqlStatement sqlStatement, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection)
Executes the batch .<O> List<O>
executeQuery(SqlStatement sqlStatement, Class<O> dataType, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, Integer limit, SqlConnection connection)
Executes a sql query returning a listint
executeUpdate(SqlStatement sqlStatement, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection)
Executes a sql query returning the number of modified rows.<O> io.vertigo.core.lang.Tuple<Integer,O>
executeUpdateWithGeneratedKey(SqlStatement sqlStatement, SqlDialect.GenerationMode generationMode, String columnName, Class<O> dataType, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection)
Executes a sql query returning the number of modified rows.SqlConnectionProvider
getConnectionProvider(String name)
-
-
-
Field Detail
-
MAIN_CONNECTION_PROVIDER_NAME
static final String MAIN_CONNECTION_PROVIDER_NAME
The name of the main connectionProvider.- See Also:
- Constant Field Values
-
-
Method Detail
-
getConnectionProvider
SqlConnectionProvider getConnectionProvider(String name)
- Parameters:
name
- ConnectionProvider name- Returns:
- SecondaryConnectionProvider
-
executeQuery
<O> List<O> executeQuery(SqlStatement sqlStatement, Class<O> dataType, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, Integer limit, SqlConnection connection) throws SQLException
Executes a sql query returning a list- Parameters:
sqlStatement
- sqlStatementdataType
- the return dataType of the listbasicTypeAdapters
- a list of adapters from complexTypes (not natively supported by db) to basicType (supported ones). Values are transformed from complex types to basic one before storage.limit
- the return limit (null if no limit)connection
- the sqlConnection- Returns:
- the list
- Throws:
SQLException
-
executeUpdate
int executeUpdate(SqlStatement sqlStatement, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) throws SQLException
Executes a sql query returning the number of modified rows.- Parameters:
sqlStatement
- sqlStatementbasicTypeAdapters
- a list of adapters from complexTypes (not natively supported by db) to basicType (supported ones). Values are transformed from complex types to basic one before storage.connection
- sqlConnection- Returns:
- either the row count for INSERT, UPDATE or DELETE statements; or 0 for SQL statements that return nothing
- Throws:
SQLException
-
executeUpdateWithGeneratedKey
<O> io.vertigo.core.lang.Tuple<Integer,O> executeUpdateWithGeneratedKey(SqlStatement sqlStatement, SqlDialect.GenerationMode generationMode, String columnName, Class<O> dataType, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) throws SQLException
Executes a sql query returning the number of modified rows.- Parameters:
sqlStatement
- sqlStatementgenerationMode
- the generation methodecolumnName
- the column name (of the generated key)dataType
- the dataType of the generated keybasicTypeAdapters
- a list of adapters from complexTypes (not natively supported by db) to basicType (supported ones). Values are transformed from complex types to basic one before storage.connection
- sqlConnection- Returns:
- a tuple with the row count for INSERT, UPDATE or DELETE statements; or 0 for SQL statements that return nothing and the generated key
- Throws:
SQLException
-
executeBatch
OptionalInt executeBatch(SqlStatement sqlStatement, Map<Class,io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) throws SQLException
Executes the batch .- Parameters:
sqlStatement
- sqlStatementbasicTypeAdapters
- a list of adapters from complexTypes (not natively supported by db) to basicType (supported ones). Values are transformed from complex types to basic one before storage.connection
- sqlConnection- Returns:
- the SUM of row count for INSERT, UPDATE or DELETE statements; or 0 for SQL statements that return nothing if no info available an empty Optional is returned
- Throws:
SQLException
- Si erreur
-
-