[#2011] Implement some micro-optimisations in DefaultRenderContext - 2.
Regular expression usage for indentation
This commit is contained in:
parent
32f89104b1
commit
2268afa4ab
@ -60,6 +60,7 @@ class DefaultRenderContext extends AbstractContext<RenderContext> implements Ren
|
||||
*/
|
||||
private static final long serialVersionUID = -8358225526567622252L;
|
||||
private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[A-Za-z][A-Za-z0-9_]*");
|
||||
private static final Pattern NEWLINE = Pattern.compile("[\\n\\r]");
|
||||
|
||||
private final StringBuilder sql;
|
||||
private boolean inline;
|
||||
@ -136,7 +137,7 @@ class DefaultRenderContext extends AbstractContext<RenderContext> implements Ren
|
||||
@Override
|
||||
public final RenderContext sql(String s) {
|
||||
if (s != null && cachedRenderFormatted) {
|
||||
sql.append(s.replaceAll("[\\n\\r]", "$0" + indentation()));
|
||||
sql.append(NEWLINE.matcher(s).replaceAll("$0" + indentation()));
|
||||
}
|
||||
else {
|
||||
sql.append(s);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user