use of io.vertigo.database.sql.statement.SqlStatement in project vertigo by KleeGroup.
the class AbstractTaskEngineSQL method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
final SqlConnection connection = obtainConnection();
final SqlStatementBuilder statementBuilder = SqlStatement.builder(getSqlQuery().trim());
setNamedParameters(statementBuilder);
final SqlStatement sqlStatement = statementBuilder.build();
try {
// Execute le Statement JDBC.
final OptionalInt sqlRowcountOpt = doExecute(sqlStatement, connection);
// On positionne le nombre de lignes affectées.
sqlRowcountOpt.ifPresent(this::setRowCount);
} catch (final BatchUpdateException sqle) {
// Gère les erreurs d'exécution Batch JDBC.
throw handleSQLException(connection, sqle.getNextException(), sqlStatement.getSqlQuery());
} catch (final SQLException sqle) {
// Gère les erreurs d'exécution JDBC.
throw handleSQLException(connection, sqle, sqlStatement.getSqlQuery());
}
}
Aggregations