- Notifications
You must be signed in to change notification settings - Fork 4
@DisableQueriesWithoutBindParameters
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() ); } }
π Β Core
π Β JVM
π Β SQL
π Β Scopes
π Β Create an annotation
π Β JUnit 4
π Β JUnit 5
π Β TestNG
π Β Spring
π Β Detect and fix N+1 SELECT
π Β Maven performance
π Β Spring Boot - JUnit 4
π Β Spring Boot - JUnit 5
π Β Micronaut Data - JUnit 5
π Β Micronaut - Spring - JUnit 5
π Β Quarkus - JUnit 5
π Β FAQ
π Β QuickPerf code