1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-15 11:56:36 +02:00
OpenIntegrations/docs/en/md/SQLite/Orm/Create-table.mdx
Vitaly the Alpaca (bot) 421ec0111e Main build (Jenkins)
2025-01-02 22:23:24 +03:00

50 lines
1.4 KiB
Plaintext
Vendored

---
sidebar_position: 1
---
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 NotExecute = False, 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 |
| NotExecute | --noex | Boolean | ✖ | True > Does not execute the query, but returns SQL text |
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
Returns: Structure Of KeyAndValue, String - The result of the execution or SQL query text
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Base = "C:\Users\Administrator\AppData\Local\Temp\v8_1E64_48.sqlite";
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);
```