Get records
Gets records from the selected table
- Parameters
- Advanced call ?
Function GetRecords(Val Table, Val Fields = "*", Val Filters = "", Val Sort = "", Val Count = "", Val Connection = "") Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Table | --table | String | ✔ | Table name |
| Fields | --fields | Array Of String | ✖ | Fields for selection |
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
| Sort | --order | Structure Of KeyAndValue | ✖ | Sorting: Key > field name, Value > direction (ASC, DESC) |
| Count | --limit | Number | ✖ | Limiting the number of received strings |
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
Returns
Map Of KeyAndValue - Result of query execution
| Parameter | Description |
|---|---|
| addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
tip
Values of the Binary data type (BLOB) are returned as {'blob':Base64 string}
1C:Enterprise/OneScript code example
Base = "/tmp/vnnmoosn.qqb.sqlite";
Table = "test";
Fields = New Array;
Fields.Add("name");
Fields.Add("salary");
Filters = New Array;
FilterStructure1 = New Structure;
FilterStructure1.Insert("field", "name");
FilterStructure1.Insert("type" , "=");
FilterStructure1.Insert("value", "Vitaly");
FilterStructure1.Insert("union", "AND");
FilterStructure1.Insert("raw" , False);
FilterStructure2 = New Structure;
FilterStructure2.Insert("field", "age");
FilterStructure2.Insert("type" , "BETWEEN");
FilterStructure2.Insert("value", "20 AND 30");
FilterStructure2.Insert("raw" , True);
Filters.Add(FilterStructure1);
Filters.Add(FilterStructure2);
Sort = New Structure("created_at", "DESC");
Count = 1;
Result = OPI_SQLite.GetRecords(Table, Fields, Filters, Sort, Count, Base);
- Bash
- CMD/Bat
oint sqlite GetRecords \
--table "test" \
--db "/tmp/v3fibjxn.cs0.sqlite"
oint sqlite GetRecords ^
--table "test" ^
--db "/tmp/v3fibjxn.cs0.sqlite"
Result
{
"data": [
{
"name": "Vitaly",
"salary": 1000.12
}
],
"result": true
}