@DisableQueriesWithoutBindParameters - quick-perf/doc GitHub Wiki
The test will fail if a query without bind parameters is found.
Bind parameters are an essential feature to prevent SQL injections and can help improve performance:
-
https://blogs.oracle.com/sql/improve-sql-query-performance-by-using-bind-variables
- https://use-the-index-luke.com/sql/where-clause/bind-parameters
- https://dzone.com/articles/why-sql-bind-variables-are-important-for-performan
In the case of skewed data, sharing a query execution plan with several executions may not be the best choice, as explained in this article.
We recommend configuring DisableQueriesWithoutBindParameters annotation with a global scope to prevent SQL injections and because, most of the time, bind parameters have a positive effect on performance.
You can disable the global scope DisableQueriesWithoutBindParameters by adding EnableQueriesWithoutBindParameters annotation on specific methods.
Configuration of DisableQueriesWithoutBindParameters with a global scope.
SpecifiableGlobalAnnotations
has to be in the org.quickperf
package.
package org.quickperf;
import org.quickperf.config.SpecifiableGlobalAnnotations;
import org.quickperf.sql.annotation.SqlAnnotationBuilder;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collection;
public class QuickPerfConfiguration implements SpecifiableGlobalAnnotations {
public Collection<Annotation> specifyAnnotationsAppliedOnEachTest() {
return Arrays.asList(
SqlAnnotationBuilder.disableQueriesWithoutBindParameters()
);
}
}