@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:

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.

🔎 Example

Configuration of DisableQueriesWithoutBindParameters with a global scope.

⚠️ The class implementing 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()
        );

    }

}
⚠️ **GitHub.com Fallback** ⚠️