Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
1.1.8
-
None
-
Linux
Description
After upgrading from 1.1.7 to 1.1.8, I noticed a performance decrease. The CPU Sampler in VisualVM pointed to MySQLParameterizedQuery.toSQL2() being the issue.
I modified this method to use a StringBuilder instead of += which seems to have addressed the issue.
Updated Code:
private String toSQL2() throws UnsupportedEncodingException {
if(queryPartsArray.length == 0)
StringBuilder sb = new StringBuilder(new String(queryPartsArray[0], "UTF-8"));
for(int i = 1; i<queryPartsArray.length; i++)
{ sb.append(parameters[i-1]); if(queryPartsArray[i].length != 0) sb.append(new String(queryPartsArray[i], "UTF-8")); } return sb.toString();
}