HHH-11458 - Optimize the SQL formatter call when iterating through multiple targets

This commit is contained in:
Timofey Gorshkov 2017-02-02 17:36:09 +03:00 committed by Vlad Mihalcea
parent efc041c9e6
commit f82dd465b1
3 changed files with 6 additions and 3 deletions

View File

@ -519,9 +519,10 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator {
ExecutionOptions options,
GenerationTarget... targets) {
if ( !StringHelper.isEmpty( sqlString ) ) {
String sqlStringFormatted = formatter.format( sqlString );
for ( GenerationTarget target : targets ) {
try {
target.accept( formatter.format( sqlString ) );
target.accept( sqlStringFormatted );
}
catch (CommandAcceptanceException e) {
if ( !quiet ) {

View File

@ -435,8 +435,9 @@ public class SchemaCreatorImpl implements SchemaCreator {
}
try {
String sqlStringFormatted = formatter.format( sqlString );
for ( GenerationTarget target : targets ) {
target.accept( formatter.format( sqlString ) );
target.accept( sqlStringFormatted );
}
}
catch (CommandAcceptanceException e) {

View File

@ -369,9 +369,10 @@ public class SchemaDropperImpl implements SchemaDropper {
return;
}
String sqlStringFormatted = formatter.format( sqlString );
for ( GenerationTarget target : targets ) {
try {
target.accept( formatter.format( sqlString ) );
target.accept( sqlStringFormatted );
}
catch (CommandAcceptanceException e) {
options.getExceptionHandler().handleException( e );