Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 2.36 KB

IncorrectUseLikeInQuery.md

File metadata and controls

44 lines (31 loc) · 2.36 KB

Incorrect use of 'LIKE' (IncorrectUseLikeInQuery)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL Major Yes 10 standard
sql
unpredictable

Description

Examples

When using the operator LIKE in the query text, it is allowed to use only

  • constant string literals
  • query parameters

It is forbidden to form a template string using calculations, use string concatenation using the query language.

Queries in which the control characters of the operator template LIKE are in query fields or in calculated expressions are interpreted differently on different DBMSs.

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:IncorrectUseLikeInQuery-off
// BSLLS:IncorrectUseLikeInQuery-on

Parameter for config

"IncorrectUseLikeInQuery": false