1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-15 11:56:36 +02:00

77 lines
2.3 KiB
Plaintext
Raw Normal View History

2025-01-07 12:27:20 +03:00
---
sidebar_position: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Create table
Creates an empty table in the database
`Function CreateTable(Val Table, Val ColoumnsStruct, Val Connection = "") Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Table | --table | String | ✔ | Table name |
| ColoumnsStruct | --cols | Structure Of KeyAndValue | ✔ | Column structure: Key > Name, Value > Data type |
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
2025-01-29 19:44:14 +03:00
Returns: Structure Of KeyAndValue, String - Result of query execution
2025-01-07 12:27:20 +03:00
<br/>
```bsl title="1C:Enterprise/OneScript code example"
2025-01-12 19:10:21 +03:00
Base = "C:\Users\Administrator\AppData\Local\Temp\v8_E607_1d.sqlite";
2025-01-07 12:27:20 +03:00
Table = "test";
ColoumnsStruct = New Structure;
ColoumnsStruct.Insert("id" , "INTEGER PRIMARY KEY");
ColoumnsStruct.Insert("name" , "TEXT");
ColoumnsStruct.Insert("age" , "INTEGER");
ColoumnsStruct.Insert("salary" , "REAL");
ColoumnsStruct.Insert("is_active" , "BOOLEAN");
ColoumnsStruct.Insert("created_at", "DATETIME");
ColoumnsStruct.Insert("data" , "BLOB");
Result = OPI_SQLite.CreateTable(Table, ColoumnsStruct, Base);
```
2025-01-10 12:07:46 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
# JSON data can also be passed as a path to a .json file
oint sqlite CreateTable \
--table "test" \
--cols "{'id':'INTEGER PRIMARY KEY','name':'TEXT','age':'INTEGER','salary':'REAL','is_active':'BOOLEAN','created_at':'DATETIME','data':'BLOB'}" \
--db "C:\Users\Administrator\AppData\Local\Temp\3pbdgv5r4nm.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 CreateTable ^
--table "test" ^
--cols "{'id':'INTEGER PRIMARY KEY','name':'TEXT','age':'INTEGER','salary':'REAL','is_active':'BOOLEAN','created_at':'DATETIME','data':'BLOB'}" ^
--db "C:\Users\Administrator\AppData\Local\Temp\3pbdgv5r4nm.sqlite"
```
</TabItem>
</Tabs>
```json title="Result"
{
"result": true
}
```