You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-08-10 22:41:43 +02:00
Main build (Jenkins)
This commit is contained in:
62
.github/workflows/oint_test_full_en.yml
vendored
62
.github/workflows/oint_test_full_en.yml
vendored
@@ -374,6 +374,48 @@ jobs:
|
||||
path: ./data.json
|
||||
|
||||
|
||||
Testing-SQLite:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [Decode, Build]
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
- uses: otymko/setup-onescript@v1.4
|
||||
with:
|
||||
version: 1.9.1
|
||||
|
||||
- name: Получить тестовые данные из кэша
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
key: test-data
|
||||
path: ./data.json
|
||||
|
||||
- name: Установить asserts и 1testrunner
|
||||
run: |
|
||||
opm install asserts
|
||||
opm install 1testrunner
|
||||
|
||||
- name: Установить OInt
|
||||
run: |
|
||||
TEMP_DEB="$(mktemp)" &&
|
||||
wget -O "$TEMP_DEB" 'https://api.athenaeum.digital/tc/job/Release/lastSuccessfulBuild/artifact/1.17.0/oint_1.17.0_all_en.deb' &&
|
||||
sudo dpkg -i "$TEMP_DEB"
|
||||
rm -f "$TEMP_DEB"
|
||||
|
||||
|
||||
|
||||
- name: Common methods
|
||||
if: ${{ cancelled() }} == false
|
||||
run: oscript /home/runner/.local/share/ovm/current/lib/1testrunner/src/main.os -run ./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os "CLI_SQLL_CommonMethods"
|
||||
|
||||
- name: Записать логи
|
||||
if: ${{ cancelled() }} == false
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
key: logs-SQLite
|
||||
path: ./docs/en/results/SQLite
|
||||
|
||||
|
||||
Testing-YandexDisk:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [Decode, Build]
|
||||
@@ -1357,7 +1399,7 @@ jobs:
|
||||
|
||||
Encode:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [Testing-Telegram,Testing-VK,Testing-Viber,Testing-Twitter,Testing-YandexDisk,Testing-GoogleWorkspace,Testing-GoogleCalendar,Testing-GoogleDrive,Testing-GoogleSheets,Testing-Notion,Testing-Slack,Testing-Airtable,Testing-Dropbox,Testing-Bitrix24,Testing-VkTeams,Testing-Ozon,Testing-Neocities,Testing-CDEK,Testing-YandexMetrika,Testing-S3,Testing-TCP]
|
||||
needs: [Testing-Telegram,Testing-VK,Testing-Viber,Testing-Twitter,Testing-SQLite,Testing-YandexDisk,Testing-GoogleWorkspace,Testing-GoogleCalendar,Testing-GoogleDrive,Testing-GoogleSheets,Testing-Notion,Testing-Slack,Testing-Airtable,Testing-Dropbox,Testing-Bitrix24,Testing-VkTeams,Testing-Ozon,Testing-Neocities,Testing-CDEK,Testing-YandexMetrika,Testing-S3,Testing-TCP]
|
||||
if: ${{ always() }}
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -1449,6 +1491,22 @@ jobs:
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/Bayselonarrend/OpenIntegrations/actions/caches?key=logs-Twitter"
|
||||
|
||||
- name: Получить логи SQLite
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
key: logs-SQLite
|
||||
path: ./docs/en/results/SQLite
|
||||
|
||||
|
||||
- name: Очистка логов SQLite
|
||||
run: |
|
||||
curl -L \
|
||||
-X DELETE \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.TOKEN }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/Bayselonarrend/OpenIntegrations/actions/caches?key=logs-SQLite"
|
||||
|
||||
- name: Получить логи YandexDisk
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
@@ -1733,7 +1791,7 @@ jobs:
|
||||
|
||||
Clear-Cache:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [Testing-Telegram, Testing-VK, Testing-Viber, Testing-Twitter, Testing-YandexDisk, Testing-GoogleWorkspace, Testing-GoogleCalendar, Testing-GoogleDrive, Testing-GoogleSheets, Testing-Notion, Testing-Slack, Testing-Airtable, Testing-Dropbox, Testing-Bitrix24, Testing-VkTeams, Testing-Ozon, Testing-Neocities, Testing-CDEK, Testing-YandexMetrika, Testing-S3, Testing-TCP, Encode]
|
||||
needs: [Testing-Telegram, Testing-VK, Testing-Viber, Testing-Twitter, Testing-SQLite, Testing-YandexDisk, Testing-GoogleWorkspace, Testing-GoogleCalendar, Testing-GoogleDrive, Testing-GoogleSheets, Testing-Notion, Testing-Slack, Testing-Airtable, Testing-Dropbox, Testing-Bitrix24, Testing-VkTeams, Testing-Ozon, Testing-Neocities, Testing-CDEK, Testing-YandexMetrika, Testing-S3, Testing-TCP, Encode]
|
||||
if: ${{ always() }}
|
||||
steps:
|
||||
- name: Очистка основного кэша
|
||||
|
11
ci/cli_ostesten
vendored
11
ci/cli_ostesten
vendored
@@ -239,6 +239,17 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Testing-SQLite') {
|
||||
steps {
|
||||
|
||||
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
powershell encoding: 'UTF-8', script:'1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_TestsCLI.os" "CLI_SQLL_CommonMethods"'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('Testing-YandexDisk') {
|
||||
steps {
|
||||
|
||||
|
11
ci/ostesten
vendored
11
ci/ostesten
vendored
@@ -239,6 +239,17 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Testing-SQLite') {
|
||||
steps {
|
||||
|
||||
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
powershell encoding: 'UTF-8', script:'1testrunner -run "./src/en/OInt/tests/Modules/internal/OPI_Tests.os" "SQLL_CommonMethods"'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('Testing-YandexDisk') {
|
||||
steps {
|
||||
|
||||
|
5
docs/en/examples/SQLite/CloseConnection.txt
vendored
Normal file
5
docs/en/examples/SQLite/CloseConnection.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
57
docs/en/examples/SQLite/ExecuteSQLQuery.txt
vendored
Normal file
57
docs/en/examples/SQLite/ExecuteSQLQuery.txt
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
// CREATE
|
||||
|
||||
QueryText = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
// INSERT with parameters
|
||||
|
||||
QueryText = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
ParameterArray = New Array;
|
||||
ParameterArray.Add("Vitaly"); // TEXT
|
||||
ParameterArray.Add(25); // INTEGER
|
||||
ParameterArray.Add(1000.12); // REAL
|
||||
ParameterArray.Add(True); // BOOL
|
||||
ParameterArray.Add(OPI_Tools.GetCurrentDate()); // DATETIME
|
||||
ParameterArray.Add(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, ParameterArray, , Connection);
|
||||
|
||||
// SELECT (The result of this query is shown in the Result block)
|
||||
|
||||
QueryText = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
// Transaction
|
||||
|
||||
QueryText = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
| age INTEGER NOT NULL
|
||||
| );
|
||||
| INSERT INTO users (name, age) VALUES ('Alice', 30);
|
||||
| INSERT INTO users (name, age) VALUES ('Bob', 25);
|
||||
| INSERT INTO users (name, age) VALUES ('Charlie', 35);
|
||||
| COMMIT;";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
@@ -30,7 +30,11 @@ import TabItem from '@theme/TabItem';
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
||||
```
|
||||
|
||||
|
||||
|
@@ -5,7 +5,7 @@ sidebar_position: 1
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Create connection
|
||||
# Create Connection
|
||||
Creates a connection to the specified base
|
||||
|
||||
|
||||
|
@@ -34,7 +34,63 @@ Without specifying the `ForcifyResult` flag, result data is returned only for qu
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
// CREATE
|
||||
|
||||
QueryText = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
// INSERT with parameters
|
||||
|
||||
QueryText = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
ParameterArray = New Array;
|
||||
ParameterArray.Add("Vitaly"); // TEXT
|
||||
ParameterArray.Add(25); // INTEGER
|
||||
ParameterArray.Add(1000.12); // REAL
|
||||
ParameterArray.Add(True); // BOOL
|
||||
ParameterArray.Add(OPI_Tools.GetCurrentDate()); // DATETIME
|
||||
ParameterArray.Add(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, ParameterArray, , Connection);
|
||||
|
||||
// SELECT (The result of this query is shown in the Result block)
|
||||
|
||||
QueryText = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
// Transaction
|
||||
|
||||
QueryText = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
| age INTEGER NOT NULL
|
||||
| );
|
||||
| INSERT INTO users (name, age) VALUES ('Alice', 30);
|
||||
| INSERT INTO users (name, age) VALUES ('Bob', 25);
|
||||
| INSERT INTO users (name, age) VALUES ('Charlie', 35);
|
||||
| COMMIT;";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
||||
```
|
||||
|
||||
|
||||
|
57
docs/ru/examples/SQLite/ВыполнитьЗапросSQL.txt
vendored
Normal file
57
docs/ru/examples/SQLite/ВыполнитьЗапросSQL.txt
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
// CREATE
|
||||
|
||||
ТекстЗапроса = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
// INSERT с параметрами
|
||||
|
||||
ТекстЗапроса = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
МассивПараметров = Новый Массив;
|
||||
МассивПараметров.Добавить("Vitaly"); // TEXT
|
||||
МассивПараметров.Добавить(25); // INTEGER
|
||||
МассивПараметров.Добавить(1000.12); // REAL
|
||||
МассивПараметров.Добавить(Истина); // BOOL
|
||||
МассивПараметров.Добавить(OPI_Инструменты.ПолучитьТекущуюДату()); // DATETIME
|
||||
МассивПараметров.Добавить(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, МассивПараметров, , Соединение);
|
||||
|
||||
// SELECT (Результат этого запроса приведен в следующем блоке)
|
||||
|
||||
ТекстЗапроса = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
// Транзакция
|
||||
|
||||
ТекстЗапроса = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
| age INTEGER NOT NULL
|
||||
| );
|
||||
| INSERT INTO users (name, age) VALUES ('Alice', 30);
|
||||
| INSERT INTO users (name, age) VALUES ('Bob', 25);
|
||||
| INSERT INTO users (name, age) VALUES ('Charlie', 35);
|
||||
| COMMIT;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
5
docs/ru/examples/SQLite/ЗакрытьСоединение.txt
vendored
Normal file
5
docs/ru/examples/SQLite/ЗакрытьСоединение.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
4
docs/ru/examples/SQLite/ОткрытьСоединение.txt
vendored
Normal file
4
docs/ru/examples/SQLite/ОткрытьСоединение.txt
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
БазаНаДиске = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
БазаВПамяти = OPI_SQLite.ОткрытьСоединение();
|
@@ -5,12 +5,12 @@ sidebar_position: 2
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Закрыть подключение
|
||||
# Закрыть соединение
|
||||
Явно закрывает переданное соединение
|
||||
|
||||
|
||||
|
||||
`Функция ЗакрытьПодключение(Знач Соединение) Экспорт`
|
||||
`Функция ЗакрытьСоединение(Знач Соединение) Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
@@ -30,7 +30,11 @@ import TabItem from '@theme/TabItem';
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
```
|
||||
|
||||
|
||||
|
@@ -5,12 +5,12 @@ sidebar_position: 1
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Создать подключение
|
||||
# Открыть соединение
|
||||
Создает подключение к указанной базе
|
||||
|
||||
|
||||
|
||||
`Функция СоздатьПодключение(Знач База = "") Экспорт`
|
||||
`Функция ОткрытьСоединение(Знач База = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
@@ -32,8 +32,8 @@ import TabItem from '@theme/TabItem';
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
БазаНаДиске = OPI_SQLite.СоздатьПодключение(ИВФ);
|
||||
БазаВПамяти = OPI_SQLite.СоздатьПодключение();
|
||||
БазаНаДиске = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
БазаВПамяти = OPI_SQLite.ОткрытьСоединение();
|
||||
```
|
||||
|
||||
|
||||
|
@@ -34,7 +34,63 @@ import TabItem from '@theme/TabItem';
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
// CREATE
|
||||
|
||||
ТекстЗапроса = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
// INSERT с параметрами
|
||||
|
||||
ТекстЗапроса = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
МассивПараметров = Новый Массив;
|
||||
МассивПараметров.Добавить("Vitaly"); // TEXT
|
||||
МассивПараметров.Добавить(25); // INTEGER
|
||||
МассивПараметров.Добавить(1000.12); // REAL
|
||||
МассивПараметров.Добавить(Истина); // BOOL
|
||||
МассивПараметров.Добавить(OPI_Инструменты.ПолучитьТекущуюДату()); // DATETIME
|
||||
МассивПараметров.Добавить(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, МассивПараметров, , Соединение);
|
||||
|
||||
// SELECT (Результат этого запроса приведен в следующем блоке)
|
||||
|
||||
ТекстЗапроса = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
// Транзакция
|
||||
|
||||
ТекстЗапроса = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
| age INTEGER NOT NULL
|
||||
| );
|
||||
| INSERT INTO users (name, age) VALUES ('Alice', 30);
|
||||
| INSERT INTO users (name, age) VALUES ('Bob', 25);
|
||||
| INSERT INTO users (name, age) VALUES ('Charlie', 35);
|
||||
| COMMIT;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
```
|
||||
|
||||
|
||||
|
12018
service/dictionaries/en.json
vendored
12018
service/dictionaries/en.json
vendored
File diff suppressed because it is too large
Load Diff
3
src/en/OInt/core/Modules/OPI_SQLite.os
vendored
3
src/en/OInt/core/Modules/OPI_SQLite.os
vendored
@@ -45,7 +45,7 @@
|
||||
|
||||
#Region CommonMethods
|
||||
|
||||
// Create connection !NOCLI
|
||||
// Create Connection !NOCLI
|
||||
// Creates a connection to the specified base
|
||||
//
|
||||
// Parameters:
|
||||
@@ -119,6 +119,7 @@ Function ExecuteSQLQuery(Val QueryText
|
||||
, Val Connection = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(QueryText);
|
||||
OPI_TypeConversion.GetBoolean(ForceResult);
|
||||
|
||||
Parameters_ = ProcessParameters(Parameters);
|
||||
Connector = CreateConnection(Connection);
|
||||
|
115
src/en/OInt/tests/Modules/internal/OPI_Tests.os
vendored
115
src/en/OInt/tests/Modules/internal/OPI_Tests.os
vendored
@@ -2219,6 +2219,8 @@ Procedure SQLL_CommonMethods() Export
|
||||
TestParameters = New Structure;
|
||||
|
||||
SQLite_CreateConnection(TestParameters);
|
||||
SQLite_CloseConnection(TestParameters);
|
||||
SQLite_ExecuteSQLQuery(TestParameters);
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -16093,6 +16095,119 @@ Procedure SQLite_CreateConnection(FunctionParameters)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure SQLite_CloseConnection(FunctionParameters)
|
||||
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Connection, "CreateConnection (closing)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_AddIn(Connection, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
||||
|
||||
// END
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Closing, "CloseConnection", "SQLite");
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Closing);
|
||||
|
||||
Try
|
||||
DeleteFiles(TFN);
|
||||
Except
|
||||
OPI_TestDataRetrieval.WriteLog(ErrorDescription(), "Database file deletion error", "SQLite");
|
||||
EndTry
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure SQLite_ExecuteSQLQuery(FunctionParameters)
|
||||
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Connection, "CreateConnection (query)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_AddIn(Connection, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
// CREATE
|
||||
|
||||
QueryText = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Create)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
// INSERT with parameters
|
||||
|
||||
QueryText = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
ParameterArray = New Array;
|
||||
ParameterArray.Add("Vitaly"); // TEXT
|
||||
ParameterArray.Add(25); // INTEGER
|
||||
ParameterArray.Add(1000.12); // REAL
|
||||
ParameterArray.Add(True); // BOOL
|
||||
ParameterArray.Add(OPI_Tools.GetCurrentDate()); // DATETIME
|
||||
ParameterArray.Add(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, ParameterArray, , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Insert)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
// SELECT (The result of this query is shown in the Result block)
|
||||
|
||||
QueryText = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Select)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
// Transaction
|
||||
|
||||
QueryText = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
| age INTEGER NOT NULL
|
||||
| );
|
||||
| INSERT INTO users (name, age) VALUES ('Alice', 30);
|
||||
| INSERT INTO users (name, age) VALUES ('Bob', 25);
|
||||
| INSERT INTO users (name, age) VALUES ('Charlie', 35);
|
||||
| COMMIT;";
|
||||
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Transaction)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
||||
|
||||
// END
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "CloseConnection (query)", "SQLite");
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result);
|
||||
|
||||
Try
|
||||
DeleteFiles(TFN);
|
||||
Except
|
||||
OPI_TestDataRetrieval.WriteLog(ErrorDescription(), "Database file deletion error", "SQLite");
|
||||
EndTry
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
|
||||
#EndRegion
|
||||
|
@@ -53,7 +53,7 @@ Function GetTestingSectionMapping() Export
|
||||
Sections.Insert("VK" , 5);
|
||||
Sections.Insert("Viber" , 5);
|
||||
Sections.Insert("Twitter" , 4);
|
||||
Sections.Insert("SQLite" , 5);
|
||||
Sections.Insert("SQLite" , 5);
|
||||
Sections.Insert("YandexDisk" , 5);
|
||||
Sections.Insert("GoogleWorkspace", 2);
|
||||
Sections.Insert("GoogleCalendar" , 5);
|
||||
@@ -86,7 +86,7 @@ Function GetTestingSectionMappingGA() Export
|
||||
Sections.Insert("VK" , StandardDependencies);
|
||||
Sections.Insert("Viber" , StandardDependencies);
|
||||
Sections.Insert("Twitter" , StandardDependencies);
|
||||
Sections.Insert("SQLite" , StandardDependencies);
|
||||
Sections.Insert("SQLite" , StandardDependencies);
|
||||
Sections.Insert("YandexDisk" , StandardDependencies);
|
||||
Sections.Insert("GoogleWorkspace", StandardDependencies);
|
||||
Sections.Insert("GoogleCalendar" , GoogleDependencies);
|
||||
@@ -132,7 +132,7 @@ Function GetTestTable() Export
|
||||
Metrika = "YandexMetrika";
|
||||
S3_ = "S3";
|
||||
TCP = "TCP";
|
||||
SQLite = "SQLite";
|
||||
SQLite = "SQLite";
|
||||
|
||||
TestTable = New ValueTable;
|
||||
TestTable.Columns.Add("Method");
|
||||
@@ -267,7 +267,7 @@ Function GetTestTable() Export
|
||||
NewTest(TestTable, "AWS_BucketsManagement" , "Buckets management" , S3_);
|
||||
NewTest(TestTable, "AWS_ObjectsManagement" , "Objects management" , S3_);
|
||||
NewTest(TestTable, "TC_Client" , "TCP Client" , TCP);
|
||||
NewTest(TestTable, "SQLL_CommonMethods" , "Common methods" , SQLite);
|
||||
NewTest(TestTable, "SQLL_CommonMethods" , "Common methods" , SQLite);
|
||||
|
||||
Return TestTable;
|
||||
|
||||
|
@@ -45,7 +45,7 @@
|
||||
|
||||
#Region CommonMethods
|
||||
|
||||
// Create connection !NOCLI
|
||||
// Create Connection !NOCLI
|
||||
// Creates a connection to the specified base
|
||||
//
|
||||
// Parameters:
|
||||
@@ -119,6 +119,7 @@ Function ExecuteSQLQuery(Val QueryText
|
||||
, Val Connection = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(QueryText);
|
||||
OPI_TypeConversion.GetBoolean(ForceResult);
|
||||
|
||||
Parameters_ = ProcessParameters(Parameters);
|
||||
Connector = CreateConnection(Connection);
|
||||
|
@@ -53,7 +53,7 @@ Function GetTestingSectionMapping() Export
|
||||
Sections.Insert("VK" , 5);
|
||||
Sections.Insert("Viber" , 5);
|
||||
Sections.Insert("Twitter" , 4);
|
||||
Sections.Insert("SQLite" , 5);
|
||||
Sections.Insert("SQLite" , 5);
|
||||
Sections.Insert("YandexDisk" , 5);
|
||||
Sections.Insert("GoogleWorkspace", 2);
|
||||
Sections.Insert("GoogleCalendar" , 5);
|
||||
@@ -86,7 +86,7 @@ Function GetTestingSectionMappingGA() Export
|
||||
Sections.Insert("VK" , StandardDependencies);
|
||||
Sections.Insert("Viber" , StandardDependencies);
|
||||
Sections.Insert("Twitter" , StandardDependencies);
|
||||
Sections.Insert("SQLite" , StandardDependencies);
|
||||
Sections.Insert("SQLite" , StandardDependencies);
|
||||
Sections.Insert("YandexDisk" , StandardDependencies);
|
||||
Sections.Insert("GoogleWorkspace", StandardDependencies);
|
||||
Sections.Insert("GoogleCalendar" , GoogleDependencies);
|
||||
@@ -132,7 +132,7 @@ Function GetTestTable() Export
|
||||
Metrika = "YandexMetrika";
|
||||
S3_ = "S3";
|
||||
TCP = "TCP";
|
||||
SQLite = "SQLite";
|
||||
SQLite = "SQLite";
|
||||
|
||||
TestTable = New ValueTable;
|
||||
TestTable.Columns.Add("Method");
|
||||
@@ -267,7 +267,7 @@ Function GetTestTable() Export
|
||||
NewTest(TestTable, "AWS_BucketsManagement" , "Buckets management" , S3_);
|
||||
NewTest(TestTable, "AWS_ObjectsManagement" , "Objects management" , S3_);
|
||||
NewTest(TestTable, "TC_Client" , "TCP Client" , TCP);
|
||||
NewTest(TestTable, "SQLL_CommonMethods" , "Common methods" , SQLite);
|
||||
NewTest(TestTable, "SQLL_CommonMethods" , "Common methods" , SQLite);
|
||||
|
||||
Return TestTable;
|
||||
|
||||
|
115
src/en/OPI/src/CommonModules/OPI_Tests/Module.bsl
vendored
115
src/en/OPI/src/CommonModules/OPI_Tests/Module.bsl
vendored
@@ -2219,6 +2219,8 @@ Procedure SQLL_CommonMethods() Export
|
||||
TestParameters = New Structure;
|
||||
|
||||
SQLite_CreateConnection(TestParameters);
|
||||
SQLite_CloseConnection(TestParameters);
|
||||
SQLite_ExecuteSQLQuery(TestParameters);
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -16093,6 +16095,119 @@ Procedure SQLite_CreateConnection(FunctionParameters)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure SQLite_CloseConnection(FunctionParameters)
|
||||
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Connection, "CreateConnection (closing)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_AddIn(Connection, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
||||
|
||||
// END
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Closing, "CloseConnection", "SQLite");
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Closing);
|
||||
|
||||
Try
|
||||
DeleteFiles(TFN);
|
||||
Except
|
||||
OPI_TestDataRetrieval.WriteLog(ErrorDescription(), "Database file deletion error", "SQLite");
|
||||
EndTry
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure SQLite_ExecuteSQLQuery(FunctionParameters)
|
||||
|
||||
TFN = GetTempFileName("sqlite");
|
||||
|
||||
Connection = OPI_SQLite.CreateConnection(TFN);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Connection, "CreateConnection (query)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_AddIn(Connection, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
// CREATE
|
||||
|
||||
QueryText = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Create)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
// INSERT with parameters
|
||||
|
||||
QueryText = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
ParameterArray = New Array;
|
||||
ParameterArray.Add("Vitaly"); // TEXT
|
||||
ParameterArray.Add(25); // INTEGER
|
||||
ParameterArray.Add(1000.12); // REAL
|
||||
ParameterArray.Add(True); // BOOL
|
||||
ParameterArray.Add(OPI_Tools.GetCurrentDate()); // DATETIME
|
||||
ParameterArray.Add(GetBinaryDataFromString("Hello world")); // BLOB
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, ParameterArray, , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Insert)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
// SELECT (The result of this query is shown in the Result block)
|
||||
|
||||
QueryText = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Select)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
// Transaction
|
||||
|
||||
QueryText = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
| age INTEGER NOT NULL
|
||||
| );
|
||||
| INSERT INTO users (name, age) VALUES ('Alice', 30);
|
||||
| INSERT INTO users (name, age) VALUES ('Bob', 25);
|
||||
| INSERT INTO users (name, age) VALUES ('Charlie', 35);
|
||||
| COMMIT;";
|
||||
|
||||
|
||||
Result = OPI_SQLite.ExecuteSQLQuery(QueryText, , , Connection);
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "ExecuteSQLQuery (Transaction)", "SQLite"); // SKIP
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result); // SKIP
|
||||
|
||||
Closing = OPI_SQLite.CloseConnection(Connection);
|
||||
|
||||
// END
|
||||
|
||||
OPI_TestDataRetrieval.WriteLog(Result, "CloseConnection (query)", "SQLite");
|
||||
OPI_TestDataRetrieval.Check_SQLiteSuccess(Result);
|
||||
|
||||
Try
|
||||
DeleteFiles(TFN);
|
||||
Except
|
||||
OPI_TestDataRetrieval.WriteLog(ErrorDescription(), "Database file deletion error", "SQLite");
|
||||
EndTry
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
|
||||
#EndRegion
|
||||
|
2
src/ru/OInt/core/Modules/OPI_SQLite.os
vendored
2
src/ru/OInt/core/Modules/OPI_SQLite.os
vendored
@@ -127,7 +127,7 @@
|
||||
Если ТипЗнч(Коннектор) <> Тип("AddIn.OPI_SQLite.Main") Тогда
|
||||
Возврат Коннектор;
|
||||
КонецЕсли;
|
||||
|
||||
|
||||
Результат = Коннектор.Execute(ТекстЗапроса, Параметры_, ФорсироватьРезультат);
|
||||
Результат = OPI_Инструменты.JsonВСтруктуру(Результат, Ложь);
|
||||
|
||||
|
146
src/ru/OInt/tests/Modules/internal/OPI_Тесты.os
vendored
146
src/ru/OInt/tests/Modules/internal/OPI_Тесты.os
vendored
@@ -2219,8 +2219,8 @@
|
||||
ПараметрыТеста = Новый Структура;
|
||||
|
||||
SQLite_ОткрытьСоединение(ПараметрыТеста);
|
||||
SQLite_ЗакрытьСоединение(ПараметрыТеста);
|
||||
SQLite_ВыполнитьЗапросSQL(ПараметрыТеста);
|
||||
SQLite_ЗакрытьСоединение(ПараметрыТеста);
|
||||
SQLite_ВыполнитьЗапросSQL(ПараметрыТеста);
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
@@ -16096,22 +16096,22 @@
|
||||
КонецПроцедуры
|
||||
|
||||
Процедура SQLite_ЗакрытьСоединение(ПараметрыФункции)
|
||||
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (закрытие)", "SQLite"); // SKIP
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (закрытие)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_Компонента(Соединение, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Закрытие, "ЗакрытьПодключение", "SQLite");
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Закрытие, "ЗакрытьПодключение", "SQLite");
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Закрытие);
|
||||
|
||||
Попытка
|
||||
|
||||
Попытка
|
||||
УдалитьФайлы(ИВФ);
|
||||
Исключение
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(ОписаниеОшибки(), "Ошибка удаления файла базы", "SQLite");
|
||||
@@ -16120,63 +16120,63 @@
|
||||
КонецПроцедуры
|
||||
|
||||
Процедура SQLite_ВыполнитьЗапросSQL(ПараметрыФункции)
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (запрос)", "SQLite"); // SKIP
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (запрос)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_Компонента(Соединение, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
// CREATE
|
||||
|
||||
ТекстЗапроса = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Create)", "SQLite"); // SKIP
|
||||
|
||||
// CREATE
|
||||
|
||||
ТекстЗапроса = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Create)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// INSERT с параметрами
|
||||
|
||||
ТекстЗапроса = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
МассивПараметров = Новый Массив;
|
||||
МассивПараметров.Добавить("Vitaly"); // TEXT
|
||||
МассивПараметров.Добавить(25); // INTEGER
|
||||
МассивПараметров.Добавить(1000.12); // REAL
|
||||
МассивПараметров.Добавить(Истина); // BOOL
|
||||
МассивПараметров.Добавить(OPI_Инструменты.ПолучитьТекущуюДату()); // DATETIME
|
||||
МассивПараметров.Добавить(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, МассивПараметров, , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Insert)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// SELECT (Результат этого запроса приведен в следующем блоке)
|
||||
|
||||
ТекстЗапроса = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Select)", "SQLite"); // SKIP
|
||||
// INSERT с параметрами
|
||||
|
||||
ТекстЗапроса = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
МассивПараметров = Новый Массив;
|
||||
МассивПараметров.Добавить("Vitaly"); // TEXT
|
||||
МассивПараметров.Добавить(25); // INTEGER
|
||||
МассивПараметров.Добавить(1000.12); // REAL
|
||||
МассивПараметров.Добавить(Истина); // BOOL
|
||||
МассивПараметров.Добавить(OPI_Инструменты.ПолучитьТекущуюДату()); // DATETIME
|
||||
МассивПараметров.Добавить(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, МассивПараметров, , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Insert)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// Транзакция
|
||||
|
||||
ТекстЗапроса = "BEGIN TRANSACTION;
|
||||
// SELECT (Результат этого запроса приведен в следующем блоке)
|
||||
|
||||
ТекстЗапроса = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Select)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// Транзакция
|
||||
|
||||
ТекстЗапроса = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
@@ -16188,19 +16188,19 @@
|
||||
| COMMIT;";
|
||||
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Transaction)", "SQLite"); // SKIP
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Transaction)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ЗакрытьПодключение (запрос)", "SQLite");
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ЗакрытьПодключение (запрос)", "SQLite");
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат);
|
||||
|
||||
Попытка
|
||||
|
||||
Попытка
|
||||
УдалитьФайлы(ИВФ);
|
||||
Исключение
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(ОписаниеОшибки(), "Ошибка удаления файла базы", "SQLite");
|
||||
|
@@ -132,7 +132,7 @@
|
||||
Метрика = "YandexMetrika";
|
||||
S3_ = "S3";
|
||||
TCP = "TCP";
|
||||
SQLite = "SQLite";
|
||||
SQLite = "SQLite";
|
||||
|
||||
ТаблицаТестов = Новый ТаблицаЗначений;
|
||||
ТаблицаТестов.Колонки.Добавить("Метод");
|
||||
@@ -2106,9 +2106,9 @@
|
||||
КонецФункции
|
||||
|
||||
Функция ПолучитьОбщийМодуль(Знач Имя)
|
||||
|
||||
|
||||
Модуль = Вычислить(Имя);
|
||||
|
||||
|
||||
Возврат Модуль;
|
||||
КонецФункции
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_SQLite.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_SQLite.os
|
||||
// Lib: SQLite
|
||||
// CLI: sqlite
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
Если ТипЗнч(Коннектор) <> Тип("AddIn.OPI_SQLite.Main") Тогда
|
||||
Возврат Коннектор;
|
||||
КонецЕсли;
|
||||
|
||||
|
||||
Результат = Коннектор.Execute(ТекстЗапроса, Параметры_, ФорсироватьРезультат);
|
||||
Результат = OPI_Инструменты.JsonВСтруктуру(Результат, Ложь);
|
||||
|
||||
|
@@ -132,7 +132,7 @@
|
||||
Метрика = "YandexMetrika";
|
||||
S3_ = "S3";
|
||||
TCP = "TCP";
|
||||
SQLite = "SQLite";
|
||||
SQLite = "SQLite";
|
||||
|
||||
ТаблицаТестов = Новый ТаблицаЗначений;
|
||||
ТаблицаТестов.Колонки.Добавить("Метод");
|
||||
|
148
src/ru/OPI/src/CommonModules/OPI_Тесты/Module.bsl
vendored
148
src/ru/OPI/src/CommonModules/OPI_Тесты/Module.bsl
vendored
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/tests/Modules/internal/OPI_Тесты.os
|
||||
// OneScript: ./OInt/tests/Modules/internal/OPI_Тесты.os
|
||||
|
||||
// MIT License
|
||||
|
||||
@@ -2219,8 +2219,8 @@
|
||||
ПараметрыТеста = Новый Структура;
|
||||
|
||||
SQLite_ОткрытьСоединение(ПараметрыТеста);
|
||||
SQLite_ЗакрытьСоединение(ПараметрыТеста);
|
||||
SQLite_ВыполнитьЗапросSQL(ПараметрыТеста);
|
||||
SQLite_ЗакрытьСоединение(ПараметрыТеста);
|
||||
SQLite_ВыполнитьЗапросSQL(ПараметрыТеста);
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
@@ -16096,22 +16096,22 @@
|
||||
КонецПроцедуры
|
||||
|
||||
Процедура SQLite_ЗакрытьСоединение(ПараметрыФункции)
|
||||
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (закрытие)", "SQLite"); // SKIP
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (закрытие)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_Компонента(Соединение, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Закрытие, "ЗакрытьПодключение", "SQLite");
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Закрытие, "ЗакрытьПодключение", "SQLite");
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Закрытие);
|
||||
|
||||
Попытка
|
||||
|
||||
Попытка
|
||||
УдалитьФайлы(ИВФ);
|
||||
Исключение
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(ОписаниеОшибки(), "Ошибка удаления файла базы", "SQLite");
|
||||
@@ -16120,63 +16120,63 @@
|
||||
КонецПроцедуры
|
||||
|
||||
Процедура SQLite_ВыполнитьЗапросSQL(ПараметрыФункции)
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("sqlite");
|
||||
|
||||
Соединение = OPI_SQLite.ОткрытьСоединение(ИВФ);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (запрос)", "SQLite"); // SKIP
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Соединение, "ОткрытьСоединение (запрос)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_Компонента(Соединение, "AddIn.OPI_SQLite.Main"); // SKIP
|
||||
|
||||
// CREATE
|
||||
|
||||
ТекстЗапроса = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Create)", "SQLite"); // SKIP
|
||||
|
||||
// CREATE
|
||||
|
||||
ТекстЗапроса = "
|
||||
|CREATE TABLE test_table (
|
||||
|id INTEGER PRIMARY KEY,
|
||||
|name TEXT,
|
||||
|age INTEGER,
|
||||
|salary REAL,
|
||||
|is_active BOOLEAN,
|
||||
|created_at DATETIME,
|
||||
|data BLOB
|
||||
|);";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Create)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// INSERT с параметрами
|
||||
|
||||
ТекстЗапроса = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
МассивПараметров = Новый Массив;
|
||||
МассивПараметров.Добавить("Vitaly"); // TEXT
|
||||
МассивПараметров.Добавить(25); // INTEGER
|
||||
МассивПараметров.Добавить(1000.12); // REAL
|
||||
МассивПараметров.Добавить(Истина); // BOOL
|
||||
МассивПараметров.Добавить(OPI_Инструменты.ПолучитьТекущуюДату()); // DATETIME
|
||||
МассивПараметров.Добавить(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, МассивПараметров, , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Insert)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// SELECT (Результат этого запроса приведен в следующем блоке)
|
||||
|
||||
ТекстЗапроса = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Select)", "SQLite"); // SKIP
|
||||
// INSERT с параметрами
|
||||
|
||||
ТекстЗапроса = "
|
||||
|INSERT INTO test_table (name, age, salary, is_active, created_at, data)
|
||||
|VALUES (?1, ?2, ?3, ?4, ?5, ?6);";
|
||||
|
||||
МассивПараметров = Новый Массив;
|
||||
МассивПараметров.Добавить("Vitaly"); // TEXT
|
||||
МассивПараметров.Добавить(25); // INTEGER
|
||||
МассивПараметров.Добавить(1000.12); // REAL
|
||||
МассивПараметров.Добавить(Истина); // BOOL
|
||||
МассивПараметров.Добавить(OPI_Инструменты.ПолучитьТекущуюДату()); // DATETIME
|
||||
МассивПараметров.Добавить(ПолучитьДвоичныеДанныеИзСтроки("Hello world")); // BLOB
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, МассивПараметров, , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Insert)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// Транзакция
|
||||
|
||||
ТекстЗапроса = "BEGIN TRANSACTION;
|
||||
// SELECT (Результат этого запроса приведен в следующем блоке)
|
||||
|
||||
ТекстЗапроса = "SELECT id, name, age, salary, is_active, created_at, data FROM test_table;";
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Select)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
// Транзакция
|
||||
|
||||
ТекстЗапроса = "BEGIN TRANSACTION;
|
||||
| CREATE TABLE IF NOT EXISTS users (
|
||||
| id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
| name TEXT NOT NULL,
|
||||
@@ -16188,19 +16188,19 @@
|
||||
| COMMIT;";
|
||||
|
||||
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Transaction)", "SQLite"); // SKIP
|
||||
Результат = OPI_SQLite.ВыполнитьЗапросSQL(ТекстЗапроса, , , Соединение);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВыполнитьЗапросSQL (Transaction)", "SQLite"); // SKIP
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат); // SKIP
|
||||
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ЗакрытьПодключение (запрос)", "SQLite");
|
||||
Закрытие = OPI_SQLite.ЗакрытьСоединение(Соединение);
|
||||
|
||||
// END
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ЗакрытьПодключение (запрос)", "SQLite");
|
||||
OPI_ПолучениеДанныхТестов.Проверка_SQLiteУспех(Результат);
|
||||
|
||||
Попытка
|
||||
|
||||
Попытка
|
||||
УдалитьФайлы(ИВФ);
|
||||
Исключение
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(ОписаниеОшибки(), "Ошибка удаления файла базы", "SQLite");
|
||||
|
Reference in New Issue
Block a user