1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-11 11:41:56 +02:00
OpenIntegrations/docs/en/md/SQLite/Orm/Update-records.mdx
Vitaly the Alpaca (bot) 02af8cc7d4 Main build (Jenkins)
2025-02-11 14:50:59 +03:00

87 lines
2.5 KiB
Plaintext
Vendored

---
sidebar_position: 5
---
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: Map Of KeyAndValue - Result of query execution
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Base = "C:\Users\Administrator\AppData\Local\Temp\v8_5571_2fd.sqlite";
Table = "test";
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);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
# JSON data can also be passed as a path to a .json file
oint sqlite UpdateRecords \
--table "test" \
--values "{'name':'Vitaly A.','salary':'999999'}" \
--filter "[{'field':'name','type':'=','value':'Vitaly','union':'AND','raw':false}]" \
--db "C:\Users\Administrator\AppData\Local\Temp\cfyaxf0knp1.sqlite"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
:: JSON data can also be passed as a path to a .json file
oint sqlite UpdateRecords ^
--table "test" ^
--values "{'name':'Vitaly A.','salary':'999999'}" ^
--filter "[{'field':'name','type':'=','value':'Vitaly','union':'AND','raw':false}]" ^
--db "C:\Users\Administrator\AppData\Local\Temp\cfyaxf0knp1.sqlite"
```
</TabItem>
</Tabs>
```json title="Result"
{
"result": true
}
```