Skip to main content

Update records

Updates the value of records by selected criteria

Function UpdateRecords(Val Table, Val ValueStructure, Val Filters = "", Val Connection = "") Export

ParameterCLI optionTypeRequiredDescription
Table--tableStringTable name
ValueStructure--valuesStructure Of KeyAndValueValues structure: Key > field, Value > field value
Filters--filterArray of StructureFilters array. See GetRecordsFilterStructure
Connection--dbString, ArbitraryExisting connection or database path
Returns

Map Of KeyAndValue - Result of query execution

1C:Enterprise/OneScript code example
Base = "/tmp/vnnmoosn.qqb.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);
# 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 "/tmp/v3fibjxn.cs0.sqlite"
Result
{
"result": true
}