Skip to main content

Create table

Creates an empty table in the database

Function CreateTable(Val Table, Val ColoumnsStruct, Val Connection = "") Export

ParameterCLI optionTypeRequiredDescription
Table--tableStringTable name
ColoumnsStruct--colsStructure Of KeyAndValueColumn structure: Key > Name, Value > Data type
Connection--dbString, ArbitraryExisting connection or database path

Returns: Structure Of KeyAndValue, String - The result of the execution or SQL query text


1C:Enterprise/OneScript code example
    Base  = "C:\Users\Administrator\AppData\Local\Temp\v8_E607_1d.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);
    # 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"
Result
{
"result": true
}