File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/main/java/org/folio/rest/utility Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,25 @@ private FormatUtility() {
19
19
20
20
}
21
21
22
+ /**
23
+ * Perform basic SQL sanitization.
24
+ *
25
+ * Only the most basic forms of sanitization is performed.
26
+ *
27
+ * Single quotes are escaped using the standard method.
28
+ * The Backslash Escape Sequence SQL feature is currently not supported.
29
+ *
30
+ * @param text The text to sanitize.
31
+ * @return The sanitized text for use in SQL queries.
32
+ */
33
+ public static String sanitizeSqlCode (String text ) {
34
+ if (text == null ) {
35
+ return text ;
36
+ }
37
+
38
+ return text .replace ("'" , "''" );
39
+ }
40
+
22
41
/**
23
42
* Escape the text to ensure it can be safely used in CQL.
24
43
*
@@ -34,7 +53,7 @@ private FormatUtility() {
34
53
* @param text The text to normalize.
35
54
* @return The normalized text for use inside the CQL as a value.
36
55
*
37
- * @see https://github.com/folio-org/raml-module-builder/blob/2c39990c96c22262b02c98dd2b51cbeedc90fb9d/util/src/main/java/org/folio/util/StringUtil.java#L39
56
+ * @see " https://github.com/folio-org/raml-module-builder/blob/2c39990c96c22262b02c98dd2b51cbeedc90fb9d/util/src/main/java/org/folio/util/StringUtil.java#L39"
38
57
*/
39
58
public static String normalizeCqlUrlArgument (String text ) {
40
59
if (text == null ) {
You can’t perform that action at this time.
0 commit comments