Use string concatenation in QueryExtractorDelegate instead of String.format(…).
We now use string concatenation during query extraction to avoid String.format(…) overhead for unknown queries. Closes #1186
This commit is contained in:
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.cql;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import com.datastax.oss.driver.api.core.cql.BatchStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.BatchableStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.BoundStatement;
|
||||
@@ -24,6 +22,9 @@ import com.datastax.oss.driver.api.core.cql.PreparedStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.Statement;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Utility to extract CQL queries from a {@link Statement}.
|
||||
*
|
||||
@@ -68,12 +69,16 @@ public class QueryExtractorDelegate {
|
||||
for (BatchableStatement<?> batchableStatement : ((BatchStatement) statement)) {
|
||||
|
||||
String query = getCql(batchableStatement);
|
||||
builder.append(query).append(query.endsWith(";") ? "" : ";");
|
||||
builder.append(query);
|
||||
|
||||
if (!ObjectUtils.isEmpty(query)) {
|
||||
builder.append(query.endsWith(";") ? "" : ";");
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
return String.format("Unknown: %s", statement);
|
||||
return "Unknown: " + statement;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user