From aa44bf6f422f40546ab0f520ebd56d129aa14a72 Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Thu, 14 Nov 2024 16:37:34 +0100 Subject: [PATCH] LDEV-5158 set initial capacity for sqltext when parsing --- core/src/main/java/lucee/runtime/db/SQLImpl.java | 2 +- .../java/lucee/runtime/tag/util/QueryParamConverter.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/lucee/runtime/db/SQLImpl.java b/core/src/main/java/lucee/runtime/db/SQLImpl.java index ca33cd940e..c7ed7c5312 100644 --- a/core/src/main/java/lucee/runtime/db/SQLImpl.java +++ b/core/src/main/java/lucee/runtime/db/SQLImpl.java @@ -105,8 +105,8 @@ public String toString(boolean pattern) { if (items.length == 0) return strSQL; - StringBuilder sb = new StringBuilder(); int sqlLen = strSQL.length(); + StringBuilder sb = new StringBuilder(sqlLen); char c, quoteType = 0, p = 0; boolean inQuotes = false; int index = 0; diff --git a/core/src/main/java/lucee/runtime/tag/util/QueryParamConverter.java b/core/src/main/java/lucee/runtime/tag/util/QueryParamConverter.java index 707d129eff..efae75c346 100644 --- a/core/src/main/java/lucee/runtime/tag/util/QueryParamConverter.java +++ b/core/src/main/java/lucee/runtime/tag/util/QueryParamConverter.java @@ -137,9 +137,9 @@ private static SQLItems toNamedSQLItem(String name, Object value) private static SQL convert(String sql, List> items, List> namedItems) throws ApplicationException, PageException { // if(namedParams.size()==0) return new Pair>(sql,params); - - StringBuilder sb = new StringBuilder(); - int sqlLen = sql.length(), initialParamSize = items.size(); + int sqlLen = sql.length(); + StringBuilder sb = new StringBuilder(sqlLen); + int initialParamSize = items.size(); char c, quoteType = 0, p = 0, pp = 0; boolean inQuotes = false; int qm = 0, _qm = 0;