Skip to content

Commit d19cf0a

Browse files
authored
Merge pull request #2774 from 1c-syntax/translations_docs-diagnostics-incorrectuselikeinquery-md--develop_en
Translate '/docs/diagnostics/IncorrectUseLikeInQuery.md' in 'en'
2 parents bc6760b + 19a22ba commit d19cf0a

File tree

1 file changed

+53
-4
lines changed

1 file changed

+53
-4
lines changed
Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# Incorrect use of 'LIKE' (IncorrectUseLikeInQuery)
22

33
<!-- Блоки выше заполняются автоматически, не трогать -->
4-
## Description
4+
## Описание диагностики
55
<!-- Описание диагностики заполняется вручную. Необходимо понятным языком описать смысл и схему работу -->
66

7-
## Examples
8-
<!-- В данном разделе приводятся примеры, на которые диагностика срабатывает, а также можно привести пример, как можно исправить ситуацию -->
9-
107
When using the operator `LIKE` in the query text, it is allowed to use only
118
- constant string literals
129
- query parameters
@@ -15,10 +12,62 @@ It is forbidden to form a template string using calculations, use string concate
1512

1613
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.
1714

15+
## Examples
16+
<!-- В данном разделе приводятся примеры, на которые диагностика срабатывает, а также можно привести пример, как можно исправить ситуацию -->
17+
18+
### String concatenation by language features
19+
20+
Allowed:
21+
22+
```
23+
Field LIKE "123%"
24+
```
25+
26+
Not allowed:
27+
28+
```
29+
Field LIKE "123" + "%"
30+
Field LIKE Table.Template
31+
```
32+
33+
### Operator template control characters LIKE are found in query fields or in calculated expressions
34+
35+
For example, instead of:
36+
37+
```
38+
Query = New Query("
39+
|SELECT
40+
| Goods.Ref
41+
|FROM
42+
| Catalog.Goods AS Goods
43+
|WHERE
44+
| Goods.Country.Description LOKE &NameTemplate + "_"
45+
|");
46+
47+
Query.SetParameter("NameTemplate", "FU");
48+
```
49+
50+
Nessesary to use:
51+
52+
```
53+
Query = New Query("
54+
|SELECT
55+
| Goods.Ref
56+
|FROM
57+
| Catalog.Goods AS Goods
58+
|WHERE
59+
| Goods.Country.Description LOKE &NameTemplate
60+
|");
61+
62+
Query.SetParameter("NameTemplate", "FU_");
63+
```
64+
1865
## Sources
1966
<!-- Необходимо указывать ссылки на все источники, из которых почерпнута информация для создания диагностики -->
2067
<!-- Примеры источников
2168
2269
* Источник: [Стандарт: Тексты модулей](https://its.1c.ru/db/v8std#content:456:hdoc)
2370
* Полезная информация: [Отказ от использования модальных окон](https://its.1c.ru/db/metod8dev#content:5272:hdoc)
2471
* Источник: [Cognitive complexity, ver. 1.4](https://www.sonarsource.com/docs/CognitiveComplexity.pdf) -->
72+
73+
- [Standard. Features of use in operator requests LIKE (RU)](https://its.1c.ru/db/v8std/content/726/hdoc?ysclid=l3g3fkmxsx)

0 commit comments

Comments
 (0)