2929import java .util .Set ;
3030import java .util .TreeSet ;
3131import java .util .function .Function ;
32- import java .util .regex .Pattern ;
3332import java .util .stream .Collectors ;
3433import java .util .stream .Stream ;
3534
8887import org .springframework .util .Assert ;
8988
9089import com .navercorp .spring .data .jdbc .plus .sql .annotation .SqlFunction ;
90+ import com .navercorp .spring .data .jdbc .plus .sql .parametersource .BindParameterNameSanitizer ;
9191
9292/**
9393 * Generates SQL statements to be used by {@link org.springframework.data.jdbc.repository.support.SimpleJdbcRepository}
@@ -113,8 +113,6 @@ class SqlGenerator {
113113 static final SqlIdentifier IDS_SQL_PARAMETER = SqlIdentifier .unquoted ("ids" );
114114 static final SqlIdentifier ROOT_ID_PARAMETER = SqlIdentifier .unquoted ("rootId" );
115115
116- private static final Pattern parameterPattern = Pattern .compile ("\\ W" );
117-
118116 private final RelationalPersistentEntity <?> entity ;
119117 private final MappingContext <RelationalPersistentEntity <?>, RelationalPersistentProperty > mappingContext ;
120118 private final RenderContext renderContext ;
@@ -236,7 +234,7 @@ private Condition getSubselectCondition(PersistentPropertyPathExtension path,
236234 }
237235
238236 private BindMarker getBindMarker (SqlIdentifier columnName ) {
239- return SQL .bindMarker (":" + parameterPattern . matcher (renderReference (columnName )). replaceAll ( "" ));
237+ return SQL .bindMarker (":" + BindParameterNameSanitizer . sanitize (renderReference (columnName )));
240238 }
241239
242240 /**
@@ -887,7 +885,7 @@ private String createUpdateWithVersionSql() {
887885
888886 Update update = createBaseUpdate () //
889887 .and (getVersionColumn ().isEqualTo (
890- SQL . bindMarker ( ":" + renderReference ( VERSION_SQL_PARAMETER ) ))) //
888+ getBindMarker ( VERSION_SQL_PARAMETER ))) //
891889 .build ();
892890
893891 return render (update );
@@ -950,7 +948,7 @@ private String createDeleteByIdAndVersionSql() {
950948
951949 Delete delete = createBaseDeleteById (getDmlTable ()) //
952950 .and (getVersionColumn ().isEqualTo (
953- SQL . bindMarker ( ":" + renderReference ( VERSION_SQL_PARAMETER ) ))) //
951+ getBindMarker ( VERSION_SQL_PARAMETER ))) //
954952 .build ();
955953
956954 return render (delete );
@@ -959,13 +957,13 @@ private String createDeleteByIdAndVersionSql() {
959957 private DeleteBuilder .DeleteWhereAndOr createBaseDeleteById (Table table ) {
960958 return Delete .builder ().from (table )
961959 .where (getIdColumn ().isEqualTo (
962- SQL . bindMarker ( ":" + renderReference ( ID_SQL_PARAMETER ) )));
960+ getBindMarker ( ID_SQL_PARAMETER )));
963961 }
964962
965963 private DeleteBuilder .DeleteWhereAndOr createBaseDeleteByIdIn (Table table ) {
966964
967965 return Delete .builder ().from (table )
968- .where (getIdColumn ().in (SQL . bindMarker ( ":" + renderReference ( IDS_SQL_PARAMETER ) )));
966+ .where (getIdColumn ().in (getBindMarker ( IDS_SQL_PARAMETER )));
969967 }
970968
971969 private String createDeleteByPathAndCriteria (PersistentPropertyPathExtension path ,
0 commit comments