2025-01-03 15:55:52 +03:00
|
|
|
---
|
|
|
|
sidebar_position: 4
|
|
|
|
---
|
|
|
|
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
|
|
|
|
# Update records
|
|
|
|
Updates the value of records by selected criteria
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function UpdateRecords(Val Table, Val ValueStructure, Val Filters = "", Val Connection = "") Export`
|
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|
|
|-|-|-|-|-|
|
|
|
|
| Table | --table | String | ✔ | Table name |
|
|
|
|
| ValueStructure | --values | Structure Of KeyAndValue | ✔ | Values structure: Key > field, Value > field value |
|
|
|
|
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStrucutre |
|
|
|
|
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
|
|
|
|
|
|
|
|
|
|
|
Returns: Structure Of KeyAndValue, String - Result of query execution
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
2025-01-05 19:22:09 +03:00
|
|
|
Base = "C:\Users\Administrator\AppData\Local\Temp\v8_1AD2_9c.sqlite";
|
2025-01-04 00:54:05 +03:00
|
|
|
Table = "test";
|
2025-01-03 15:55:52 +03:00
|
|
|
|
2025-01-04 00:54:05 +03:00
|
|
|
FieldsStructure = New Structure;
|
|
|
|
FieldsStructure.Insert("name" , "Vitaly A.");
|
|
|
|
FieldsStructure.Insert("salary", "999999");
|
|
|
|
|
|
|
|
Filters = New Array;
|
|
|
|
|
|
|
|
FilterStructure = New Structure;
|
|
|
|
|
|
|
|
FilterStructure.Insert("field", "name");
|
|
|
|
FilterStructure.Insert("type" , "=");
|
|
|
|
FilterStructure.Insert("value", "Vitaly");
|
|
|
|
FilterStructure.Insert("union", "AND");
|
|
|
|
FilterStructure.Insert("raw" , False);
|
|
|
|
|
|
|
|
Filters.Add(FilterStructure);
|
|
|
|
|
|
|
|
Result = OPI_SQLite.UpdateRecords(Table, FieldsStructure, FilterStructure, Base);
|
2025-01-03 15:55:52 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|