-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SqlIdentifierParameterSource now sanitizes identifier names
- Loading branch information
Showing
3 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...a/com/navercorp/spring/data/jdbc/plus/sql/parametersource/BindParameterNameSanitizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.navercorp.spring.data.jdbc.plus.sql.parametersource; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* Sanitizes the name of bind parameters, so they don't contain any illegal characters. | ||
* | ||
* @author Jens Schauder | ||
* | ||
* @since 3.0.2 | ||
* | ||
* COPY: org.springframework.data.jdbc.core.convert.BindParameterNameSanitizer | ||
*/ | ||
public abstract class BindParameterNameSanitizer { | ||
|
||
private static final Pattern parameterPattern = Pattern.compile("\\W"); | ||
|
||
public static String sanitize(String rawName) { | ||
return parameterPattern.matcher(rawName).replaceAll(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters