Package io.vertigo.database.impl.sql
Class SqlManagerImpl
java.lang.Object
io.vertigo.database.impl.sql.SqlManagerImpl
- All Implemented Interfaces:
io.vertigo.core.node.component.Component,io.vertigo.core.node.component.CoreComponent,io.vertigo.core.node.component.Manager,SqlManager
Implémentation standard du gestionnaire des données et des accès aux données.
- Author:
- pchretien
-
Field Summary
Fields inherited from interface io.vertigo.database.sql.SqlManager
MAIN_CONNECTION_PROVIDER_NAME -
Constructor Summary
ConstructorsConstructorDescriptionSqlManagerImpl(io.vertigo.core.locale.LocaleManager localeManager, io.vertigo.core.analytics.AnalyticsManager analyticsManager, List<SqlConnectionProviderPlugin> sqlConnectionProviderPlugins) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionexecuteBatch(SqlStatement sqlStatement, Map<Class, io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) Executes the batch .executeBatchWithGeneratedKeys(SqlStatement sqlStatement, SqlDialect.GenerationMode generationMode, String columnName, Class<O> dataType, Map<Class, io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) <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 listintexecuteUpdate(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.getConnectionProvider(String name)
-
Constructor Details
-
SqlManagerImpl
@Inject public SqlManagerImpl(io.vertigo.core.locale.LocaleManager localeManager, io.vertigo.core.analytics.AnalyticsManager analyticsManager, List<SqlConnectionProviderPlugin> sqlConnectionProviderPlugins) Constructor.- Parameters:
localeManager- Manager des messages localisésanalyticsManager- Manager de la performance applicativesqlConnectionProviderPlugins- List of connectionProviderPlugin. Names must be unique.
-
-
Method Details
-
getConnectionProvider
- Specified by:
getConnectionProviderin interfaceSqlManager- Parameters:
name- ConnectionProvider name- Returns:
- SecondaryConnectionProvider
-
executeQuery
public <O> List<O> executeQuery(SqlStatement sqlStatement, Class<O> dataType, Map<Class, io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, Integer limit, SqlConnection connection) throws SQLExceptionExecutes a sql query returning a list- Specified by:
executeQueryin interfaceSqlManager- 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
-
executeUpdateWithGeneratedKey
public <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 SQLExceptionExecutes a sql query returning the number of modified rows.- Specified by:
executeUpdateWithGeneratedKeyin interfaceSqlManager- 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
-
executeUpdate
public int executeUpdate(SqlStatement sqlStatement, Map<Class, io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) throws SQLExceptionExecutes a sql query returning the number of modified rows.- Specified by:
executeUpdatein interfaceSqlManager- 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
-
executeBatch
public OptionalInt executeBatch(SqlStatement sqlStatement, Map<Class, io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) throws SQLExceptionExecutes the batch .- Specified by:
executeBatchin interfaceSqlManager- 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
-
executeBatchWithGeneratedKeys
public <O> io.vertigo.core.lang.Tuple<Integer,List<O>> executeBatchWithGeneratedKeys(SqlStatement sqlStatement, SqlDialect.GenerationMode generationMode, String columnName, Class<O> dataType, Map<Class, io.vertigo.core.lang.BasicTypeAdapter> basicTypeAdapters, SqlConnection connection) throws SQLException- Specified by:
executeBatchWithGeneratedKeysin interfaceSqlManager- Throws:
SQLException
-