You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2026-06-16 04:03:20 +02:00
Main build (Jenkins)
This commit is contained in:
@@ -1 +1 @@
|
||||
EC6AE1F4B030F89B5361A34FC4616D37EF8098F0375E1F60A2B3AE5E49B8A9E0
|
||||
38DB48AC53A342BD9F8F466B70AAD373924C6BFFA039198CBB69D3F551AE6012
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Create database and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Create database
|
||||
Creates a database with the specified name
|
||||
|
||||
|
||||
|
||||
`Function CreateDatabase(Val Base, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Base | --base | String | ✔ | Database name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, , Login, Password);
|
||||
|
||||
Base = "testbase1";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.CreateDatabase(Base, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql CreateDatabase \
|
||||
--base "testbase2" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql CreateDatabase ^
|
||||
--base "testbase2" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Drop database and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Drop database
|
||||
Deletes the database
|
||||
|
||||
|
||||
|
||||
`Function DeleteDatabase(Val Base, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Base | --base | String | ✔ | Database name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, , Login, Password);
|
||||
|
||||
Base = "testbase1";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.DeleteDatabase(Base, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteDatabase \
|
||||
--base "testbase2" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteDatabase ^
|
||||
--base "testbase2" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Database management",
|
||||
"position": "3"
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Add rows and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add rows
|
||||
Adds new rows to the table
|
||||
|
||||
|
||||
|
||||
`Function AddRecords(Val Table, Val DataArray, Val Transaction = True, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
Record data is specified as an array of structures of the following type:<br/>`{'Field name 1': {'Type': 'Value'}, 'Field name 2': {'Type': 'Value'},...}`
|
||||
|
||||
List of available types is described on the initial page of the MSSQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "testtable";
|
||||
RecordsArray = New Array;
|
||||
|
||||
Image = "https://hut.openintegrations.dev/test_data/picture.jpg";
|
||||
OPI_TypeConversion.GetBinaryData(Image); // Image - Type: BinaryData
|
||||
|
||||
XML = "<?xml version=""1.0""?><root>
|
||||
| <element>
|
||||
| <name>Example</name>
|
||||
| <value>123</value>
|
||||
| </element>
|
||||
| <element>
|
||||
| <name>Test</name>
|
||||
| <value>456</value>
|
||||
| </element>
|
||||
|</root>";
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
CurrentDateTZ = OPI_Tools.DateRFC3339(CurrentDate, "+05:00");
|
||||
|
||||
RecordStructure = New Structure;
|
||||
RecordStructure.Insert("tinyint_field" , New Structure("TINYINT" , 5));
|
||||
RecordStructure.Insert("smallint_field" , New Structure("SMALLINT" , 2000));
|
||||
RecordStructure.Insert("int_field" , New Structure("INT" , 200000));
|
||||
RecordStructure.Insert("bigint_field" , New Structure("BIGINT" , 20000000000));
|
||||
RecordStructure.Insert("float24_field" , New Structure("FLOAT24" , 10.1234567));
|
||||
RecordStructure.Insert("float53_field" , New Structure("FLOAT53" , 10.123456789123456));
|
||||
RecordStructure.Insert("bit_field" , New Structure("BIT" , True));
|
||||
RecordStructure.Insert("nvarchar_field" , New Structure("NVARCHAR" , "Some text"));
|
||||
RecordStructure.Insert("varbinary_field", New Structure("BYTES" , Image));
|
||||
RecordStructure.Insert("uid_field" , New Structure("UUID" , New UUID));
|
||||
RecordStructure.Insert("numeric_field" , New Structure("NUMERIC" , 5.333));
|
||||
RecordStructure.Insert("xml_field" , New Structure("XML" , XML));
|
||||
RecordStructure.Insert("date_field" , New Structure("DATE" , CurrentDate));
|
||||
RecordStructure.Insert("time_field" , New Structure("TIME" , CurrentDate));
|
||||
RecordStructure.Insert("dto_field" , New Structure("DATETIMEOFFSET", CurrentDateTZ));
|
||||
RecordStructure.Insert("datetime_field" , New Structure("DATETIME" , CurrentDate));
|
||||
|
||||
RecordsArray.Add(RecordStructure);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.AddRecords(Table, RecordsArray, True, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql AddRecords \
|
||||
--table "testtable" \
|
||||
--rows "[{'tinyint_field':{'TINYINT':'5'},'smallint_field':{'SMALLINT':'2000'},'int_field':{'INT':'200000'},'bigint_field':{'BIGINT':'20000000000'},'float24_field':{'FLOAT24':'10.1234567'},'float53_field':{'FLOAT53':'10.1234567891235'},'bit_field':{'BIT':true},'nvarchar_field':{'NVARCHAR':'Some text'},'varbinary_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\24nza3st.3m4'},'uid_field':{'UUID':'06667da8-efb5-443b-85a5-d17ca781a586'},'numeric_field':{'NUMERIC':'5.333'},'xml_field':{'XML':'<?xml version=\"1.0\"?><root>\n <element>\n <name>Example</name>\n <value>123</value>\n </element>\n <element>\n <name>Test</name>\n <value>456</value>\n </element>\n</root>'},'date_field':{'DATE':'2/20/2026 1:05:29 PM'},'time_field':{'TIME':'2/20/2026 1:05:29 PM'},'dto_field':{'DATETIMEOFFSET':'2/20/2026 11:05:29 AM'},'datetime_field':{'DATETIME':'2/20/2026 1:05:29 PM'}}]" \
|
||||
--trn true \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql AddRecords ^
|
||||
--table "testtable" ^
|
||||
--rows "[{'tinyint_field':{'TINYINT':'5'},'smallint_field':{'SMALLINT':'2000'},'int_field':{'INT':'200000'},'bigint_field':{'BIGINT':'20000000000'},'float24_field':{'FLOAT24':'10.1234567'},'float53_field':{'FLOAT53':'10.1234567891235'},'bit_field':{'BIT':true},'nvarchar_field':{'NVARCHAR':'Some text'},'varbinary_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\24nza3st.3m4'},'uid_field':{'UUID':'06667da8-efb5-443b-85a5-d17ca781a586'},'numeric_field':{'NUMERIC':'5.333'},'xml_field':{'XML':'<?xml version=\"1.0\"?><root>\n <element>\n <name>Example</name>\n <value>123</value>\n </element>\n <element>\n <name>Test</name>\n <value>456</value>\n </element>\n</root>'},'date_field':{'DATE':'2/20/2026 1:05:29 PM'},'time_field':{'TIME':'2/20/2026 1:05:29 PM'},'dto_field':{'DATETIMEOFFSET':'2/20/2026 11:05:29 AM'},'datetime_field':{'DATETIME':'2/20/2026 1:05:29 PM'}}]" ^
|
||||
--trn true ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"commit": {
|
||||
"result": true
|
||||
},
|
||||
"result": true,
|
||||
"rows": 1,
|
||||
"errors": []
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,101 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Delete records and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete records
|
||||
Deletes records from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteRecords(Val Table, Val Filters = "", Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "test_data";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "gender");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("NVARCHAR", "Male"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
FilterStructure.Insert("union", "AND");
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "ip_address");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("NVARCHAR", "127.0.0.1"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.DeleteRecords(Table, Filters, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteRecords \
|
||||
--table "test_data" \
|
||||
--filter "[{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false,'union':'AND'},{'field':'ip_address','type':'=','value':{'NVARCHAR':'127.0.0.1'},'raw':false}]" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteRecords ^
|
||||
--table "test_data" ^
|
||||
--filter "[{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false,'union':'AND'},{'field':'ip_address','type':'=','value':{'NVARCHAR':'127.0.0.1'},'raw':false}]" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Ensure records and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure records
|
||||
Adds records or updates data of existing ones when key fields match
|
||||
|
||||
|
||||
|
||||
`Function EnsureRecords(Val Table, Val DataArray, Val KeyFields = "", Val Transaction = True, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| KeyFields | --unique | Array Of String | ✖ | Name or names of key table fields for uniqueness validation |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "test_guarantee";
|
||||
|
||||
DataArray = New Array;
|
||||
|
||||
RowStructure2 = New Structure;
|
||||
RowStructure2.Insert("id" , New Structure("INT" , 1));
|
||||
RowStructure2.Insert("name" , New Structure("NVARCHAR", "Vitaly"));
|
||||
RowStructure2.Insert("age" , New Structure("INT" , 25));
|
||||
RowStructure2.Insert("salary", New Structure("DECIMAL" , 1000.12));
|
||||
|
||||
RowStructure1 = New Structure;
|
||||
RowStructure1.Insert("id" , New Structure("INT" , 2));
|
||||
RowStructure1.Insert("name" , New Structure("NVARCHAR", "Lesha"));
|
||||
RowStructure1.Insert("age" , New Structure("INT" , 20));
|
||||
RowStructure1.Insert("salary", New Structure("DECIMAL" , 200.20));
|
||||
|
||||
DataArray.Add(RowStructure2);
|
||||
DataArray.Add(RowStructure1);
|
||||
|
||||
KeyFields = New Array;
|
||||
KeyFields.Add("id");
|
||||
|
||||
Result = OPI_MSSQL.EnsureRecords(Table, DataArray, KeyFields, , ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql EnsureRecords \
|
||||
--table "test_guarantee" \
|
||||
--rows "[{'id':{'INT':'1'},'name':{'NVARCHAR':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DECIMAL':'1500.5'}},{'id':{'INT':'3'},'name':{'NVARCHAR':'Anton'},'age':{'INT':'30'},'salary':{'DECIMAL':'3000'}}]" \
|
||||
--unique "['id']" \
|
||||
--db "Server=127.0.0.1;Database=testbase1;User Id=SA;Password="12we3456!2154";" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql EnsureRecords ^
|
||||
--table "test_guarantee" ^
|
||||
--rows "[{'id':{'INT':'1'},'name':{'NVARCHAR':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DECIMAL':'1500.5'}},{'id':{'INT':'3'},'name':{'NVARCHAR':'Anton'},'age':{'INT':'30'},'salary':{'DECIMAL':'3000'}}]" ^
|
||||
--unique "['id']" ^
|
||||
--db "Server=127.0.0.1;Database=testbase1;User Id=SA;Password="12we3456!2154";" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Get records filter Structure and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records filter Structure
|
||||
Gets the template structure for filtering records in ORM queries
|
||||
|
||||
|
||||
|
||||
`Function GetRecordsFilterStructure(Val Clear = False) Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Clear | --empty | Boolean | ✖ | True > structure with empty valuse, False > field descriptions at values |
|
||||
|
||||
|
||||
Returns: Structure Of KeyAndValue - Record filter element
|
||||
|
||||
:::tip
|
||||
The use of the `raw` feature is necessary for compound constructions like `BETWEEN`. For example: with `raw:false` the filter `type:BETWEEN` `value:10 AND 20` will be interpolated as `BETWEEN ?1 ` where `?1 = "10 AND 20,"' which would cause an error.. In such a case, you must use `raw:true` to set the condition directly in the query text
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Result = OPI_MSSQL.GetRecordsFilterStructure();
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint mssql GetRecordsFilterStructure \
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint mssql GetRecordsFilterStructure ^
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"field": "<filtering field name>",
|
||||
"type": "<comparison type>",
|
||||
"value": "<comparison value>",
|
||||
"union": "<connection with the following condition: AND, OR, etc..>",
|
||||
"raw": "<true - the value will be inserted by text as it is, false - through the parameter>"
|
||||
}
|
||||
```
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Get records and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records
|
||||
Gets records from the selected table
|
||||
|
||||
|
||||
|
||||
`Function GetRecords(Val Table, Val Fields = "*", Val Filters = "", Val Sort = "", Val Count = "", Val Connection = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
// All records without filters
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.GetRecords(Table, , , , , ConnectionString, TLSSettings);
|
||||
|
||||
// Filter, selected fields, limit and sorting
|
||||
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, "test_data", Login, Password);
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
Fields = New Array;
|
||||
Fields.Add("first_name");
|
||||
Fields.Add("last_name");
|
||||
Fields.Add("email");
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure1 = New Structure;
|
||||
|
||||
FilterStructure1.Insert("field", "gender");
|
||||
FilterStructure1.Insert("type" , "=");
|
||||
FilterStructure1.Insert("value", "Male");
|
||||
FilterStructure1.Insert("union", "AND");
|
||||
FilterStructure1.Insert("raw" , False);
|
||||
|
||||
FilterStructure2 = New Structure;
|
||||
|
||||
FilterStructure2.Insert("field", "id");
|
||||
FilterStructure2.Insert("type" , "BETWEEN");
|
||||
FilterStructure2.Insert("value", "20 AND 50");
|
||||
FilterStructure2.Insert("raw" , True);
|
||||
|
||||
Filters.Add(FilterStructure1);
|
||||
Filters.Add(FilterStructure2);
|
||||
|
||||
Sort = New Structure("ip_address", "DESC");
|
||||
Count = 5;
|
||||
|
||||
Result = OPI_MSSQL.GetRecords(Table, Fields, Filters, Sort, Count, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql GetRecords \
|
||||
--table "testtable" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql GetRecords ^
|
||||
--table "testtable" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"bigint_field": 20000000000,
|
||||
"bit_field": 1,
|
||||
"date_field": "2026-02-20",
|
||||
"datetime_field": "2026-02-20T13:05:29",
|
||||
"dto_field": "2026-02-20T14:05:29+03:00",
|
||||
"float24_field": 10.1234569549561,
|
||||
"float53_field": 10.1234567891235,
|
||||
"int_field": 200000,
|
||||
"numeric_field": 5.333,
|
||||
"nvarchar_field": "Some text",
|
||||
"smallint_field": 2000,
|
||||
"time_field": "13:05:29",
|
||||
"tinyint_field": 5,
|
||||
"uid_field": "06667da8-efb5-443b-85a5-d17ca781a586",
|
||||
"varbinary_field": {
|
||||
"BYTES": "/9j/4VTBRX..."
|
||||
},
|
||||
"xml_field": "<root><element><name>Example</name><value>123</value></element><element><name>Test</name><value>456</value></element></root>"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Update records and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Update records
|
||||
Updates the value of records by selected criteria
|
||||
|
||||
|
||||
|
||||
`Function UpdateRecords(Val Table, Val ValueStructure, Val Filters = "", Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| ValueStructure | --values | Structure Of KeyAndValue | ✔ | Values structure: Key > field, Value > field value |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
Record data is specified as an array of structures of the following type:<br/>`{'Field name 1': {'Type': 'Value'}, 'Field name 2': {'Type': 'Value'},...}`
|
||||
|
||||
List of available types is described on the initial page of the MSSQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "test_data";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
FieldsStructure = New Structure;
|
||||
FieldsStructure.Insert("ip_address", New Structure("VARCHAR", "127.0.0.1"));
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "gender");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("NVARCHAR", "Male"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.UpdateRecords(Table, FieldsStructure, FilterStructure, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql UpdateRecords \
|
||||
--table "test_data" \
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" \
|
||||
--filter "{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false}" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql UpdateRecords ^
|
||||
--table "test_data" ^
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" ^
|
||||
--filter "{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false}" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Record management",
|
||||
"position": "5"
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Add table column and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add table column
|
||||
Adds a new column to an existing table
|
||||
|
||||
|
||||
|
||||
`Function AddTableColumn(Val Table, Val Name, Val DataType, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| DataType | --type | String | ✔ | Column data type |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
|
||||
Base = "testbase1";
|
||||
Table = "testtable";
|
||||
Name = "new_field";
|
||||
DataType = "bigint";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.AddTableColumn(Table, Name, DataType, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql AddTableColumn \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--type "bigint" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql AddTableColumn ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--type "bigint" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Clear table and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Clear table
|
||||
Clears the database table
|
||||
|
||||
|
||||
|
||||
`Function ClearTable(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.ClearTable(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql ClearTable \
|
||||
--table "testtable" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql ClearTable ^
|
||||
--table "testtable" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Create table and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
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 = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
List of available types is described on the initial page of the MSSQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
ColoumnsStruct = New Structure;
|
||||
ColoumnsStruct.Insert("tinyint_field" , "tinyint");
|
||||
ColoumnsStruct.Insert("smallint_field" , "smallint");
|
||||
ColoumnsStruct.Insert("int_field" , "int");
|
||||
ColoumnsStruct.Insert("bigint_field" , "bigint");
|
||||
ColoumnsStruct.Insert("float24_field" , "float(24)");
|
||||
ColoumnsStruct.Insert("float53_field" , "float(53)");
|
||||
ColoumnsStruct.Insert("bit_field" , "bit");
|
||||
ColoumnsStruct.Insert("nvarchar_field" , "nvarchar(4000)");
|
||||
ColoumnsStruct.Insert("varbinary_field", "varbinary(max)");
|
||||
ColoumnsStruct.Insert("uid_field" , "uniqueidentifier");
|
||||
ColoumnsStruct.Insert("numeric_field" , "numeric(5,3)"); // Or decimal
|
||||
ColoumnsStruct.Insert("xml_field" , "xml");
|
||||
ColoumnsStruct.Insert("date_field" , "date");
|
||||
ColoumnsStruct.Insert("time_field" , "time");
|
||||
ColoumnsStruct.Insert("dto_field" , "datetimeoffset");
|
||||
ColoumnsStruct.Insert("datetime_field" , "datetime");
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.CreateTable(Table, ColoumnsStruct, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql CreateTable \
|
||||
--table "somename" \
|
||||
--cols "{'tinyint_field':'tinyint','smallint_field':'smallint','int_field':'int','bigint_field':'bigint','float24_field':'float(24)','float53_field':'float(53)','bit_field':'bit','nvarchar_field':'nvarchar(4000)','varbinary_field':'varbinary(max)','uid_field':'uniqueidentifier','numeric_field':'numeric(5,3)','xml_field':'xml','date_field':'date','time_field':'time','dto_field':'datetimeoffset','datetime_field':'datetime','wtf_field':'WTF'}" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql CreateTable ^
|
||||
--table "somename" ^
|
||||
--cols "{'tinyint_field':'tinyint','smallint_field':'smallint','int_field':'int','bigint_field':'bigint','float24_field':'float(24)','float53_field':'float(53)','bit_field':'bit','nvarchar_field':'nvarchar(4000)','varbinary_field':'varbinary(max)','uid_field':'uniqueidentifier','numeric_field':'numeric(5,3)','xml_field':'xml','date_field':'date','time_field':'time','dto_field':'datetimeoffset','datetime_field':'datetime','wtf_field':'WTF'}" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Delete table column and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table column
|
||||
Deletes a column from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteTableColumn(Val Table, Val Name, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
|
||||
Base = "testbase1";
|
||||
Table = "testtable";
|
||||
Name = "new_field";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.DeleteTableColumn(Table, Name, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteTableColumn \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteTableColumn ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Delete table and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table
|
||||
Deletes a table from the database
|
||||
|
||||
|
||||
|
||||
`Function DeleteTable(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.DeleteTable(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteTable \
|
||||
--table "test_data" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql DeleteTable ^
|
||||
--table "test_data" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Ensure table and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure table
|
||||
Creates a new table if it does not exist or updates the composition of columns in an existing table
|
||||
|
||||
|
||||
|
||||
`Function EnsureTable(Val Table, Val ColoumnsStruct, Val Connection = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
As a result of changing the table structure, data may be lost! It is recommended to test this method on test data beforehand
|
||||
|
||||
This function does not update the data type of existing columns
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
|
||||
Base = "testbase1";
|
||||
Table = "testtable";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
ColoumnsStruct = New Structure;
|
||||
ColoumnsStruct.Insert("smallint_field" , "smallint");
|
||||
ColoumnsStruct.Insert("double_field" , "real");
|
||||
ColoumnsStruct.Insert("bigint_field" , "bigint");
|
||||
ColoumnsStruct.Insert("custom_field" , "nvarchar");
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.EnsureTable(Table, ColoumnsStruct, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql EnsureTable \
|
||||
--table "test_new" \
|
||||
--cols "{'smallint_field':'smallint','double_field':'real','bigint_field':'bigint','custom_field':'nvarchar'}" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql EnsureTable ^
|
||||
--table "test_new" ^
|
||||
--cols "{'smallint_field':'smallint','double_field':'real','bigint_field':'bigint','custom_field':'nvarchar'}" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true,
|
||||
"commit": {
|
||||
"result": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,191 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
description: Get table information and other functions to work with MSSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get table information
|
||||
Gets information about the table
|
||||
|
||||
|
||||
|
||||
`Function GetTableInformation(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "SA";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLSSettings = OPI_MSSQL.GetTLSSettings(True);
|
||||
ConnectionString = OPI_MSSQL.GenerateConnectionString(Address, Base, Login, Password);
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MSSQL.GetTableInformation(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql GetTableInformation \
|
||||
--table "test_new" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mssql GetTableInformation ^
|
||||
--table "test_new" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "tinyint_field",
|
||||
"data_type": "tinyint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "smallint_field",
|
||||
"data_type": "smallint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "int_field",
|
||||
"data_type": "int",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "bigint_field",
|
||||
"data_type": "bigint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "float24_field",
|
||||
"data_type": "real",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "float53_field",
|
||||
"data_type": "float",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "bit_field",
|
||||
"data_type": "bit",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": 4000,
|
||||
"column_default": null,
|
||||
"column_name": "nvarchar_field",
|
||||
"data_type": "nvarchar",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": -1,
|
||||
"column_default": null,
|
||||
"column_name": "varbinary_field",
|
||||
"data_type": "varbinary",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "uid_field",
|
||||
"data_type": "uniqueidentifier",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "numeric_field",
|
||||
"data_type": "numeric",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": -1,
|
||||
"column_default": null,
|
||||
"column_name": "xml_field",
|
||||
"data_type": "xml",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "date_field",
|
||||
"data_type": "date",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "time_field",
|
||||
"data_type": "time",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "dto_field",
|
||||
"data_type": "datetimeoffset",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "datetime_field",
|
||||
"data_type": "datetime",
|
||||
"is_nullable": "YES"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Table management",
|
||||
"position": "4"
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Create database and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Create database
|
||||
Creates a database with the specified name
|
||||
|
||||
|
||||
|
||||
`Function CreateDatabase(Val Base, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Base | --base | String | ✔ | Database name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Base = "testbase1";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.CreateDatabase(Base, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql CreateDatabase \
|
||||
--base "testbase2" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql CreateDatabase ^
|
||||
--base "testbase2" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Drop database and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Drop database
|
||||
Deletes the database
|
||||
|
||||
|
||||
|
||||
`Function DeleteDatabase(Val Base, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Base | --base | String | ✔ | Database name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Base = "testbase1";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.DeleteDatabase(Base, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteDatabase \
|
||||
--base "testbase2" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteDatabase ^
|
||||
--base "testbase2" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Database management",
|
||||
"position": "3"
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Add rows and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add rows
|
||||
Adds new rows to the table
|
||||
|
||||
|
||||
|
||||
`Function AddRecords(Val Table, Val DataArray, Val Transaction = True, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
Record data is specified as an array of structures of the following type:<br/>`{'Field name 1': {'Type': 'Value'}, 'Field name 2': {'Type': 'Value'},...}`
|
||||
|
||||
The list of available types is described on the initial page of the MySQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
RecordsArray = New Array;
|
||||
|
||||
Image = "https://hut.openintegrations.dev/test_data/picture.jpg";
|
||||
OPI_TypeConversion.GetBinaryData(Image); // Image - Type: BinaryData
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
|
||||
RecordStructure = New Structure;
|
||||
RecordStructure.Insert("char_field" , New Structure("TEXT" , "AAAAA"));
|
||||
RecordStructure.Insert("varchar_field" , New Structure("TEXT" , "Some varchar"));
|
||||
RecordStructure.Insert("tinytext_field" , New Structure("TEXT" , "Some tiny text"));
|
||||
RecordStructure.Insert("text_field" , New Structure("TEXT" , "Some text"));
|
||||
RecordStructure.Insert("mediumtext_field", New Structure("TEXT" , "Some medium text"));
|
||||
RecordStructure.Insert("longtext_field" , New Structure("TEXT" , "Some looooooong text"));
|
||||
RecordStructure.Insert("tinyint_field" , New Structure("INT" , 127));
|
||||
RecordStructure.Insert("smallint_field" , New Structure("INT" , -32767));
|
||||
RecordStructure.Insert("mediumint_field" , New Structure("INT" , 8388607));
|
||||
RecordStructure.Insert("int_field" , New Structure("INT" , -2147483647));
|
||||
RecordStructure.Insert("uint_field" , New Structure("UINT" , 4294967295));
|
||||
RecordStructure.Insert("bigint_field" , New Structure("INT" , 9223372036854775807));
|
||||
RecordStructure.Insert("float_field" , New Structure("FLOAT" , 100.50));
|
||||
RecordStructure.Insert("double_field" , New Structure("FLOAT" , 100.512123));
|
||||
RecordStructure.Insert("date_field" , New Structure("DATE" , CurrentDate));
|
||||
RecordStructure.Insert("time_field" , New Structure("TIME" , CurrentDate));
|
||||
RecordStructure.Insert("datetime_field" , New Structure("DATE" , CurrentDate));
|
||||
RecordStructure.Insert("timestamp_field" , New Structure("DATE" , CurrentDate));
|
||||
RecordStructure.Insert("mediumblob_field", New Structure("BYTES" , Image));
|
||||
RecordStructure.Insert("set_field" , New Structure("TEXT" , "one"));
|
||||
|
||||
RecordsArray.Add(RecordStructure);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.AddRecords(Table, RecordsArray, True, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql AddRecords \
|
||||
--table "testtable" \
|
||||
--rows "[{'char_field':{'TEXT':'AAAAA'},'varchar_field':{'TEXT':'Some varchar'},'tinytext_field':{'TEXT':'Some tiny text'},'text_field':{'TEXT':'Some text'},'mediumtext_field':{'TEXT':'Some medium text'},'longtext_field':{'TEXT':'Some looooooong text'},'tinyint_field':{'INT':'127'},'smallint_field':{'INT':'-32767'},'mediumint_field':{'INT':'8388607'},'int_field':{'INT':'-2147483647'},'uint_field':{'UINT':'4294967295'},'bigint_field':{'INT':'9223372036854775807'},'float_field':{'FLOAT':'100.5'},'double_field':{'FLOAT':'100.512123'},'date_field':{'DATE':'2/20/2026 1:03:20 PM'},'time_field':{'TIME':'2/20/2026 1:03:20 PM'},'datetime_field':{'DATE':'2/20/2026 1:03:20 PM'},'timestamp_field':{'DATE':'2/20/2026 1:03:20 PM'},'mediumblob_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\jnalsyhg.sj3'},'set_field':{'TEXT':'one'}}]" \
|
||||
--trn true \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql AddRecords ^
|
||||
--table "testtable" ^
|
||||
--rows "[{'char_field':{'TEXT':'AAAAA'},'varchar_field':{'TEXT':'Some varchar'},'tinytext_field':{'TEXT':'Some tiny text'},'text_field':{'TEXT':'Some text'},'mediumtext_field':{'TEXT':'Some medium text'},'longtext_field':{'TEXT':'Some looooooong text'},'tinyint_field':{'INT':'127'},'smallint_field':{'INT':'-32767'},'mediumint_field':{'INT':'8388607'},'int_field':{'INT':'-2147483647'},'uint_field':{'UINT':'4294967295'},'bigint_field':{'INT':'9223372036854775807'},'float_field':{'FLOAT':'100.5'},'double_field':{'FLOAT':'100.512123'},'date_field':{'DATE':'2/20/2026 1:03:20 PM'},'time_field':{'TIME':'2/20/2026 1:03:20 PM'},'datetime_field':{'DATE':'2/20/2026 1:03:20 PM'},'timestamp_field':{'DATE':'2/20/2026 1:03:20 PM'},'mediumblob_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\jnalsyhg.sj3'},'set_field':{'TEXT':'one'}}]" ^
|
||||
--trn true ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"commit": {
|
||||
"result": true
|
||||
},
|
||||
"result": true,
|
||||
"rows": 1,
|
||||
"errors": []
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Delete records and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete records
|
||||
Deletes records from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteRecords(Val Table, Val Filters = "", Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "test_data";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "gender");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("VARCHAR", "Male"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
FilterStructure.Insert("union", "AND");
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "ip_address");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("VARCHAR", "127.0.0.1"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.DeleteRecords(Table, Filters, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteRecords \
|
||||
--table "test_data" \
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false,'union':'AND'}]" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteRecords ^
|
||||
--table "test_data" ^
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false,'union':'AND'}]" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,104 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Ensure records and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure records
|
||||
Adds records or updates data of existing ones when key fields match
|
||||
|
||||
|
||||
|
||||
`Function EnsureRecords(Val Table, Val DataArray, Val Transaction = True, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
All UNIQUE and PRIMARY KEY fields of the table serve as key fields
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "test_merge";
|
||||
|
||||
DataArray = New Array;
|
||||
|
||||
RowStructure2 = New Structure;
|
||||
RowStructure2.Insert("id" , New Structure("INT" , 1));
|
||||
RowStructure2.Insert("name" , New Structure("TEXT" , "Vitaly"));
|
||||
RowStructure2.Insert("age" , New Structure("INT" , 25));
|
||||
RowStructure2.Insert("salary", New Structure("DOUBLE", 1000.12));
|
||||
|
||||
RowStructure1 = New Structure;
|
||||
RowStructure1.Insert("id" , New Structure("INT" , 2));
|
||||
RowStructure1.Insert("name" , New Structure("TEXT" , "Lesha"));
|
||||
RowStructure1.Insert("age" , New Structure("INT" , 20));
|
||||
RowStructure1.Insert("salary", New Structure("DOUBLE", 200.20));
|
||||
|
||||
DataArray.Add(RowStructure2);
|
||||
DataArray.Add(RowStructure1);
|
||||
|
||||
KeyFields = New Array;
|
||||
KeyFields.Add("id");
|
||||
|
||||
Result = OPI_MySQL.EnsureRecords(Table, DataArray, , ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql EnsureRecords \
|
||||
--table "test_merge" \
|
||||
--rows "[{'id':{'INT':'1'},'name':{'TEXT':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DOUBLE':'1500.5'}},{'id':{'INT':'3'},'name':{'TEXT':'Anton'},'age':{'INT':'30'},'salary':{'DOUBLE':'3000'}}]" \
|
||||
--db "mysql://bayselonarrend:12we3456!2154@127.0.0.1:3307/testbase1" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql EnsureRecords ^
|
||||
--table "test_merge" ^
|
||||
--rows "[{'id':{'INT':'1'},'name':{'TEXT':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DOUBLE':'1500.5'}},{'id':{'INT':'3'},'name':{'TEXT':'Anton'},'age':{'INT':'30'},'salary':{'DOUBLE':'3000'}}]" ^
|
||||
--db "mysql://bayselonarrend:12we3456!2154@127.0.0.1:3307/testbase1" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Get records filter Structure and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records filter Structure
|
||||
Gets the template structure for filtering records in ORM queries
|
||||
|
||||
|
||||
|
||||
`Function GetRecordsFilterStructure(Val Clear = False) Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Clear | --empty | Boolean | ✖ | True > structure with empty valuse, False > field descriptions at values |
|
||||
|
||||
|
||||
Returns: Structure Of KeyAndValue - Record filter element
|
||||
|
||||
:::tip
|
||||
The use of the `raw` feature is necessary for compound constructions like `BETWEEN`. For example: with `raw:false` the filter `type:BETWEEN` `value:10 AND 20` will be interpolated as `BETWEEN ?1 ` where `?1 = "10 AND 20,"' which would cause an error.. In such a case, you must use `raw:true` to set the condition directly in the query text
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Result = OPI_MySQL.GetRecordsFilterStructure();
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint mysql GetRecordsFilterStructure \
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint mysql GetRecordsFilterStructure ^
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"field": "<filtering field name>",
|
||||
"type": "<comparison type>",
|
||||
"value": "<comparison value>",
|
||||
"union": "<connection with the following condition: AND, OR, etc..>",
|
||||
"raw": "<true - the value will be inserted by text as it is, false - through the parameter>"
|
||||
}
|
||||
```
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Get records and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records
|
||||
Gets records from the selected table
|
||||
|
||||
|
||||
|
||||
`Function GetRecords(Val Table, Val Fields = "*", Val Filters = "", Val Sort = "", Val Count = "", Val Connection = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
// All records without filters
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.GetRecords(Table, , , , , ConnectionString, TLSSettings);
|
||||
|
||||
// Filter, selected fields, limit and sorting
|
||||
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, "test_data", Login, Password, Port);
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
Fields = New Array;
|
||||
Fields.Add("first_name");
|
||||
Fields.Add("last_name");
|
||||
Fields.Add("email");
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure1 = New Structure;
|
||||
|
||||
FilterStructure1.Insert("field", "gender");
|
||||
FilterStructure1.Insert("type" , "=");
|
||||
FilterStructure1.Insert("value", "Male");
|
||||
FilterStructure1.Insert("union", "AND");
|
||||
FilterStructure1.Insert("raw" , False);
|
||||
|
||||
FilterStructure2 = New Structure;
|
||||
|
||||
FilterStructure2.Insert("field", "id");
|
||||
FilterStructure2.Insert("type" , "BETWEEN");
|
||||
FilterStructure2.Insert("value", "20 AND 50");
|
||||
FilterStructure2.Insert("raw" , True);
|
||||
|
||||
Filters.Add(FilterStructure1);
|
||||
Filters.Add(FilterStructure2);
|
||||
|
||||
Sort = New Structure("ip_address", "DESC");
|
||||
Count = 5;
|
||||
|
||||
Result = OPI_MySQL.GetRecords(Table, Fields, Filters, Sort, Count, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql GetRecords \
|
||||
--table "testtable" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql GetRecords ^
|
||||
--table "testtable" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"bigint_field": 9223372036854775807,
|
||||
"char_field": "AAAAA",
|
||||
"date_field": "2026-02-20T03:00:00+03:00",
|
||||
"datetime_field": "2026-02-20T16:03:20+03:00",
|
||||
"double_field": 100.51212310791,
|
||||
"float_field": 100.5,
|
||||
"int_field": -2147483647,
|
||||
"longtext_field": "Some looooooong text",
|
||||
"mediumblob_field": {
|
||||
"BYTES": "/9j/4VTBRX..."
|
||||
},
|
||||
"mediumint_field": 8388607,
|
||||
"mediumtext_field": "Some medium text",
|
||||
"set_field": "one",
|
||||
"smallint_field": -32767,
|
||||
"text_field": "Some text",
|
||||
"time_field": "1970-01-01T15:03:20+02:00",
|
||||
"timestamp_field": "2026-02-20T16:03:20+03:00",
|
||||
"tinyint_field": 127,
|
||||
"tinytext_field": "Some tiny text",
|
||||
"uint_field": 4294967295,
|
||||
"varchar_field": "Some varchar"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Update records and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Update records
|
||||
Updates the value of records by selected criteria
|
||||
|
||||
|
||||
|
||||
`Function UpdateRecords(Val Table, Val ValueStructure, Val Filters = "", Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| ValueStructure | --values | Structure Of KeyAndValue | ✔ | Values structure: Key > field, Value > field value |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
Record data is specified as an array of structures of the following type:<br/>`{'Field name 1': {'Type': 'Value'}, 'Field name 2': {'Type': 'Value'},...}`
|
||||
|
||||
The list of available types is described on the initial page of the MySQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "test_data";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
FieldsStructure = New Structure;
|
||||
FieldsStructure.Insert("ip_address", New Structure("VARCHAR", "127.0.0.1"));
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "gender");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("VARCHAR", "Male"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.UpdateRecords(Table, FieldsStructure, FilterStructure, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql UpdateRecords \
|
||||
--table "test_data" \
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" \
|
||||
--filter "{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false}" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql UpdateRecords ^
|
||||
--table "test_data" ^
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" ^
|
||||
--filter "{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false}" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Record management",
|
||||
"position": "5"
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Add table column and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add table column
|
||||
Adds a new column to an existing table
|
||||
|
||||
|
||||
|
||||
`Function AddTableColumn(Val Table, Val Name, Val DataType, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| DataType | --type | String | ✔ | Column data type |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
Name = "new_field";
|
||||
DataType = "MEDIUMTEXT";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.AddTableColumn(Table, Name, DataType, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql AddTableColumn \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--type "MEDIUMTEXT" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql AddTableColumn ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--type "MEDIUMTEXT" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Clear table and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Clear table
|
||||
Clears the database table
|
||||
|
||||
|
||||
|
||||
`Function ClearTable(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.ClearTable(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql ClearTable \
|
||||
--table "testtable" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql ClearTable ^
|
||||
--table "testtable" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Create table and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
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 = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
The list of available types is described on the initial page of the MySQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
ColoumnsStruct = New Structure;
|
||||
ColoumnsStruct.Insert("char_field" , "CHAR(5)");
|
||||
ColoumnsStruct.Insert("varchar_field" , "VARCHAR(255)");
|
||||
ColoumnsStruct.Insert("tinytext_field" , "TINYTEXT");
|
||||
ColoumnsStruct.Insert("text_field" , "TEXT");
|
||||
ColoumnsStruct.Insert("mediumtext_field", "MEDIUMTEXT");
|
||||
ColoumnsStruct.Insert("longtext_field" , "LONGTEXT");
|
||||
ColoumnsStruct.Insert("tinyint_field" , "TINYINT");
|
||||
ColoumnsStruct.Insert("smallint_field" , "SMALLINT");
|
||||
ColoumnsStruct.Insert("mediumint_field" , "MEDIUMINT");
|
||||
ColoumnsStruct.Insert("int_field" , "INT");
|
||||
ColoumnsStruct.Insert("uint_field" , "INT UNSIGNED");
|
||||
ColoumnsStruct.Insert("bigint_field" , "BIGINT");
|
||||
ColoumnsStruct.Insert("float_field" , "FLOAT");
|
||||
ColoumnsStruct.Insert("double_field" , "DOUBLE");
|
||||
ColoumnsStruct.Insert("date_field" , "DATE");
|
||||
ColoumnsStruct.Insert("time_field" , "TIME");
|
||||
ColoumnsStruct.Insert("datetime_field" , "DATETIME");
|
||||
ColoumnsStruct.Insert("timestamp_field" , "TIMESTAMP");
|
||||
ColoumnsStruct.Insert("mediumblob_field", "MEDIUMBLOB");
|
||||
ColoumnsStruct.Insert("set_field" , "SET('one','two','three')");
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.CreateTable(Table, ColoumnsStruct, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql CreateTable \
|
||||
--table "somename" \
|
||||
--cols "{'char_field':'CHAR(5)','varchar_field':'VARCHAR(255)','tinytext_field':'TINYTEXT','text_field':'TEXT','mediumtext_field':'MEDIUMTEXT','longtext_field':'LONGTEXT','tinyint_field':'TINYINT','smallint_field':'SMALLINT','mediumint_field':'MEDIUMINT','int_field':'INT','uint_field':'INT UNSIGNED','bigint_field':'BIGINT','float_field':'FLOAT','double_field':'DOUBLE','date_field':'DATE','time_field':'TIME','datetime_field':'DATETIME','timestamp_field':'TIMESTAMP','mediumblob_field':'MEDIUMBLOB','set_field':'SET(\u0027one\u0027,\u0027two\u0027,\u0027three\u0027)','wtf_field':'WTF'}" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql CreateTable ^
|
||||
--table "somename" ^
|
||||
--cols "{'char_field':'CHAR(5)','varchar_field':'VARCHAR(255)','tinytext_field':'TINYTEXT','text_field':'TEXT','mediumtext_field':'MEDIUMTEXT','longtext_field':'LONGTEXT','tinyint_field':'TINYINT','smallint_field':'SMALLINT','mediumint_field':'MEDIUMINT','int_field':'INT','uint_field':'INT UNSIGNED','bigint_field':'BIGINT','float_field':'FLOAT','double_field':'DOUBLE','date_field':'DATE','time_field':'TIME','datetime_field':'DATETIME','timestamp_field':'TIMESTAMP','mediumblob_field':'MEDIUMBLOB','set_field':'SET(\u0027one\u0027,\u0027two\u0027,\u0027three\u0027)','wtf_field':'WTF'}" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,88 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Delete table column and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table column
|
||||
Deletes a column from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteTableColumn(Val Table, Val Name, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
Name = "new_field";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.DeleteTableColumn(Table, Name, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteTableColumn \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteTableColumn ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Delete table and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table
|
||||
Deletes a table from the database
|
||||
|
||||
|
||||
|
||||
`Function DeleteTable(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.DeleteTable(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteTable \
|
||||
--table "test_data" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql DeleteTable ^
|
||||
--table "test_data" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Ensure table and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure table
|
||||
Creates a new table if it does not exist or updates the composition of columns in an existing table
|
||||
|
||||
|
||||
|
||||
`Function EnsureTable(Val Table, Val ColoumnsStruct, Val Connection = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
As a result of changing the table structure, data may be lost! It is recommended to test this method on test data beforehand
|
||||
|
||||
This function does not update the data type of existing columns
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
ColoumnsStruct = New Structure;
|
||||
ColoumnsStruct.Insert("smallint_field" , "SMALLINT");
|
||||
ColoumnsStruct.Insert("double_field" , "DOUBLE");
|
||||
ColoumnsStruct.Insert("bigint_field" , "BIGINT");
|
||||
ColoumnsStruct.Insert("custom_field" , "TEXT");
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.EnsureTable(Table, ColoumnsStruct, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql EnsureTable \
|
||||
--table "test_new" \
|
||||
--cols "{'smallint_field':'SMALLINT','double_field':'DOUBLE','bigint_field':'BIGINT','custom_field':'TEXT'}" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql EnsureTable ^
|
||||
--table "test_new" ^
|
||||
--cols "{'smallint_field':'SMALLINT','double_field':'DOUBLE','bigint_field':'BIGINT','custom_field':'TEXT'}" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true,
|
||||
"commit": {
|
||||
"result": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,232 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
description: Get table information and other functions to work with MySQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get table information
|
||||
Gets information about the table
|
||||
|
||||
|
||||
|
||||
`Function GetTableInformation(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 3306;
|
||||
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_MySQL.GetTableInformation(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql GetTableInformation \
|
||||
--table "test_new" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint mysql GetTableInformation ^
|
||||
--table "test_new" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "bigint_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "YmlnaW50"
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": 5,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "char_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "Y2hhcg=="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "date_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "ZGF0ZQ=="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "datetime_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "ZGF0ZXRpbWU="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "double_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "ZG91Ymxl"
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "float_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "ZmxvYXQ="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "int_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "aW50"
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": 4294967295,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "longtext_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "bG9uZ3RleHQ="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": 16777215,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "mediumblob_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "bWVkaXVtYmxvYg=="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "mediumint_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "bWVkaXVtaW50"
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": 16777215,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "mediumtext_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "bWVkaXVtdGV4dA=="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": 13,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "set_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "c2V0"
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "smallint_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "c21hbGxpbnQ="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": 65535,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "text_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "dGV4dA=="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "time_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "dGltZQ=="
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "timestamp_field",
|
||||
"DATA_TYPE": {
|
||||
"BYTES": "dGltZXN0YW1w"
|
||||
},
|
||||
"IS_NULLABLE": "YES"
|
||||
},
|
||||
{
|
||||
"CHARACTER_MAXIMUM_LENGTH": null,
|
||||
"COLUMN_DEFAULT": null,
|
||||
"COLUMN_NAME": "tinyint_field",
|
||||
...
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Table management",
|
||||
"position": "4"
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Create database and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Create database
|
||||
Creates a database with the specified name
|
||||
|
||||
|
||||
|
||||
`Function CreateDatabase(Val Base, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Base | --base | String | ✔ | Database name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "postgres";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Base = "testbase1";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.CreateDatabase(Base, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres CreateDatabase \
|
||||
--base "testbase2" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres CreateDatabase ^
|
||||
--base "testbase2" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Drop database and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Drop database
|
||||
Deletes the database
|
||||
|
||||
|
||||
|
||||
`Function DeleteDatabase(Val Base, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Base | --base | String | ✔ | Database name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "postgres";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Base = "testbase1";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.DeleteDatabase(Base, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteDatabase \
|
||||
--base "testbase2" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteDatabase ^
|
||||
--base "testbase2" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Disable all database connections and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Disable all database connections
|
||||
Terminates all connections to the database except the current one
|
||||
|
||||
|
||||
|
||||
`Function DisableAllDatabaseConnections(Val Base, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Base | --base | String | ✔ | Database name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.DisableAllDatabaseConnections(Base, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DisableAllDatabaseConnections \
|
||||
--base "testbase2" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DisableAllDatabaseConnections ^
|
||||
--base "testbase2" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Database management",
|
||||
"position": "3"
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Add rows and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add rows
|
||||
Adds new rows to the table
|
||||
|
||||
|
||||
|
||||
`Function AddRecords(Val Table, Val DataArray, Val Transaction = True, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
Record data is specified as an array of structures of the following type:<br/>`{'Field name 1': {'Type': 'Value'}, 'Field name 2': {'Type': 'Value'},...}`
|
||||
|
||||
The list of available types is described on the initial page of the PostgreSQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
RecordsArray = New Array;
|
||||
|
||||
Image = "https://hut.openintegrations.dev/test_data/picture.jpg";
|
||||
OPI_TypeConversion.GetBinaryData(Image); // Image - Type: BinaryData
|
||||
|
||||
CasualStructure = New Structure("key,value", "ItsKey", 10);
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
CurrentDateTZ = OPI_Tools.DateRFC3339(CurrentDate, "+05:00");
|
||||
|
||||
RecordStructure = New Structure;
|
||||
RecordStructure.Insert("bool_field" , New Structure("BOOL" , True));
|
||||
RecordStructure.Insert("oldchar_field" , New Structure("OLDCHAR" , 1)); // or "char"
|
||||
RecordStructure.Insert("smallint_field" , New Structure("SMALLINT" , 5));
|
||||
RecordStructure.Insert("smallserial_field", New Structure("SMALLSERIAL" , 6));
|
||||
RecordStructure.Insert("int_field" , New Structure("INT" , 100));
|
||||
RecordStructure.Insert("serial_field" , New Structure("SERIAL" , 100));
|
||||
RecordStructure.Insert("oid_field" , New Structure("OID" , 24576));
|
||||
RecordStructure.Insert("bigint_field" , New Structure("BIGINT" , 9999999));
|
||||
RecordStructure.Insert("bigserial_field" , New Structure("BIGSERIAL" , 9999999));
|
||||
RecordStructure.Insert("real_field" , New Structure("REAL" , 15.2));
|
||||
RecordStructure.Insert("dp_field" , New Structure("DOUBLE_PRECISION" , 1.0002)); // or DOUBLE PRECISION
|
||||
RecordStructure.Insert("text_field" , New Structure("TEXT" , "Some text"));
|
||||
RecordStructure.Insert("varchar_field" , New Structure("VARCHAR" , "Some varchar"));
|
||||
RecordStructure.Insert("charn_field" , New Structure("CHAR" , "AAA"));
|
||||
RecordStructure.Insert("char_field" , New Structure("CHAR" , "A"));
|
||||
RecordStructure.Insert("name_field" , New Structure("NAME" , "Vitaly"));
|
||||
RecordStructure.Insert("bytea_field" , New Structure("BYTEA" , Image));
|
||||
RecordStructure.Insert("ts_field" , New Structure("TIMESTAMP" , CurrentDate));
|
||||
RecordStructure.Insert("tswtz_field" , New Structure("TIMESTAMP_WITH_TIME_ZONE", CurrentDateTZ)); // or TIMESTAMP WITH TIME ZONE
|
||||
RecordStructure.Insert("ip_field" , New Structure("INET" , "127.0.0.1"));
|
||||
RecordStructure.Insert("json_field" , New Structure("JSON" , CasualStructure));
|
||||
RecordStructure.Insert("jsonb_field" , New Structure("JSONB" , CasualStructure));
|
||||
RecordStructure.Insert("date_field" , New Structure("DATE" , CurrentDate));
|
||||
RecordStructure.Insert("time_field" , New Structure("TIME" , CurrentDate));
|
||||
RecordStructure.Insert("uuid_field" , New Structure("UUID" , New UUID));
|
||||
RecordStructure.Insert("numeric_field" , New Structure("NUMERIC" , "15.2"));
|
||||
|
||||
RecordsArray.Add(RecordStructure);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.AddRecords(Table, RecordsArray, True, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres AddRecords \
|
||||
--table "testtable" \
|
||||
--rows "[{'bool_field':{'BOOL':true},'oldchar_field':{'OLDCHAR':'1'},'smallint_field':{'SMALLINT':'5'},'smallserial_field':{'SMALLSERIAL':'6'},'int_field':{'INT':'100'},'serial_field':{'SERIAL':'100'},'oid_field':{'OID':'24576'},'bigint_field':{'BIGINT':'9999999'},'bigserial_field':{'BIGSERIAL':'9999999'},'real_field':{'REAL':'15.2'},'dp_field':{'DOUBLE_PRECISION':'1.0002'},'text_field':{'TEXT':'Some text'},'varchar_field':{'VARCHAR':'Some varchar'},'charn_field':{'CHAR':'AAA'},'char_field':{'CHAR':'A'},'name_field':{'NAME':'Vitaly'},'bytea_field':{'BYTEA':'C:\\Users\\bayse\\AppData\\Local\\Temp\\2nrf1bgm.5bv'},'ts_field':{'TIMESTAMP':'2/20/2026 12:59:34 PM'},'tswtz_field':{'TIMESTAMP_WITH_TIME_ZONE':'2/20/2026 10:59:34 AM'},'ip_field':{'INET':'127.0.0.1'},'json_field':{'JSON':{'key':'***','value':'10'}},'jsonb_field':{'JSONB':{'key':'***','value':'10'}},'date_field':{'DATE':'2/20/2026 12:59:34 PM'},'time_field':{'TIME':'2/20/2026 12:59:34 PM'},'uuid_field':{'UUID':'98db495d-a9a8-4716-a5fb-b15a6d55ee7a'},'numeric_field':{'NUMERIC':'15.2'}}]" \
|
||||
--trn true \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres AddRecords ^
|
||||
--table "testtable" ^
|
||||
--rows "[{'bool_field':{'BOOL':true},'oldchar_field':{'OLDCHAR':'1'},'smallint_field':{'SMALLINT':'5'},'smallserial_field':{'SMALLSERIAL':'6'},'int_field':{'INT':'100'},'serial_field':{'SERIAL':'100'},'oid_field':{'OID':'24576'},'bigint_field':{'BIGINT':'9999999'},'bigserial_field':{'BIGSERIAL':'9999999'},'real_field':{'REAL':'15.2'},'dp_field':{'DOUBLE_PRECISION':'1.0002'},'text_field':{'TEXT':'Some text'},'varchar_field':{'VARCHAR':'Some varchar'},'charn_field':{'CHAR':'AAA'},'char_field':{'CHAR':'A'},'name_field':{'NAME':'Vitaly'},'bytea_field':{'BYTEA':'C:\\Users\\bayse\\AppData\\Local\\Temp\\2nrf1bgm.5bv'},'ts_field':{'TIMESTAMP':'2/20/2026 12:59:34 PM'},'tswtz_field':{'TIMESTAMP_WITH_TIME_ZONE':'2/20/2026 10:59:34 AM'},'ip_field':{'INET':'127.0.0.1'},'json_field':{'JSON':{'key':'***','value':'10'}},'jsonb_field':{'JSONB':{'key':'***','value':'10'}},'date_field':{'DATE':'2/20/2026 12:59:34 PM'},'time_field':{'TIME':'2/20/2026 12:59:34 PM'},'uuid_field':{'UUID':'98db495d-a9a8-4716-a5fb-b15a6d55ee7a'},'numeric_field':{'NUMERIC':'15.2'}}]" ^
|
||||
--trn true ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"commit": {
|
||||
"result": true
|
||||
},
|
||||
"result": true,
|
||||
"rows": 1,
|
||||
"errors": []
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Delete records and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete records
|
||||
Deletes records from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteRecords(Val Table, Val Filters = "", Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "test_data";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "gender");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("VARCHAR", "Male"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
FilterStructure.Insert("union", "AND");
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "ip_address");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("VARCHAR", "127.0.0.1"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.DeleteRecords(Table, Filters, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteRecords \
|
||||
--table "test_data" \
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false,'union':'AND'}]" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteRecords ^
|
||||
--table "test_data" ^
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false,'union':'AND'}]" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,107 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Ensure records and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure records
|
||||
Adds records or updates data of existing ones when key fields match
|
||||
|
||||
|
||||
|
||||
`Function EnsureRecords(Val Table, Val DataArray, Val KeyFields = "", Val Transaction = True, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| KeyFields | --unique | Array Of String | ✖ | Name or names of key table fields for uniqueness validation |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
UNIQUE and PRIMARY KEY fields can be specified as key fields
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "test_merge";
|
||||
|
||||
DataArray = New Array;
|
||||
|
||||
RowStructure2 = New Structure;
|
||||
RowStructure2.Insert("id" , New Structure("INT" , 1));
|
||||
RowStructure2.Insert("name" , New Structure("TEXT", "Vitaly"));
|
||||
RowStructure2.Insert("age" , New Structure("INT" , 25));
|
||||
RowStructure2.Insert("salary", New Structure("REAL", 1000.12));
|
||||
|
||||
RowStructure1 = New Structure;
|
||||
RowStructure1.Insert("id" , New Structure("INT" , 2));
|
||||
RowStructure1.Insert("name" , New Structure("TEXT", "Lesha"));
|
||||
RowStructure1.Insert("age" , New Structure("INT" , 20));
|
||||
RowStructure1.Insert("salary", New Structure("REAL", 200.20));
|
||||
|
||||
DataArray.Add(RowStructure2);
|
||||
DataArray.Add(RowStructure1);
|
||||
|
||||
KeyFields = New Array;
|
||||
KeyFields.Add("id");
|
||||
|
||||
Result = OPI_PostgreSQL.EnsureRecords(Table, DataArray, KeyFields, , ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres EnsureRecords \
|
||||
--table "test_merge" \
|
||||
--rows "[{'id':{'INT':'1'},'name':{'TEXT':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'REAL':'1500.5'}},{'id':{'INT':'3'},'name':{'TEXT':'Anton'},'age':{'INT':'30'},'salary':{'REAL':'3000'}}]" \
|
||||
--unique "['id']" \
|
||||
--db "postgresql://bayselonarrend:12we3456!2154@127.0.0.1:5433/testbase1" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres EnsureRecords ^
|
||||
--table "test_merge" ^
|
||||
--rows "[{'id':{'INT':'1'},'name':{'TEXT':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'REAL':'1500.5'}},{'id':{'INT':'3'},'name':{'TEXT':'Anton'},'age':{'INT':'30'},'salary':{'REAL':'3000'}}]" ^
|
||||
--unique "['id']" ^
|
||||
--db "postgresql://bayselonarrend:12we3456!2154@127.0.0.1:5433/testbase1" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Get records filter Structure and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records filter Structure
|
||||
Gets the template structure for filtering records in ORM queries
|
||||
|
||||
|
||||
|
||||
`Function GetRecordsFilterStructure(Val Clear = False) Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Clear | --empty | Boolean | ✖ | True > structure with empty valuse, False > field descriptions at values |
|
||||
|
||||
|
||||
Returns: Structure Of KeyAndValue - Record filter element
|
||||
|
||||
:::tip
|
||||
The use of the `raw` feature is necessary for compound constructions like `BETWEEN`. For example: with `raw:false` the filter `type:BETWEEN` `value:10 AND 20` will be interpolated as `BETWEEN ?1 ` where `?1 = "10 AND 20,"' which would cause an error.. In such a case, you must use `raw:true` to set the condition directly in the query text
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Result = OPI_PostgreSQL.GetRecordsFilterStructure();
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint postgres GetRecordsFilterStructure \
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint postgres GetRecordsFilterStructure ^
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"field": "<filtering field name>",
|
||||
"type": "<comparison type>",
|
||||
"value": "<comparison value>",
|
||||
"union": "<connection with the following condition: AND, OR, etc..>",
|
||||
"raw": "<true - the value will be inserted by text as it is, false - through the parameter>"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,170 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Get records and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records
|
||||
Gets records from the selected table
|
||||
|
||||
|
||||
|
||||
`Function GetRecords(Val Table, Val Fields = "*", Val Filters = "", Val Sort = "", Val Count = "", Val Connection = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
// All records without filters
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.GetRecords(Table, , , , , ConnectionString, TLSSettings);
|
||||
|
||||
// Filter, selected fields, limit and sorting
|
||||
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, "test_data", Login, Password, Port);
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
Fields = New Array;
|
||||
Fields.Add("first_name");
|
||||
Fields.Add("last_name");
|
||||
Fields.Add("email");
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure1 = New Structure;
|
||||
|
||||
FilterStructure1.Insert("field", "gender");
|
||||
FilterStructure1.Insert("type" , "=");
|
||||
FilterStructure1.Insert("value", "Male");
|
||||
FilterStructure1.Insert("union", "AND");
|
||||
FilterStructure1.Insert("raw" , False);
|
||||
|
||||
FilterStructure2 = New Structure;
|
||||
|
||||
FilterStructure2.Insert("field", "id");
|
||||
FilterStructure2.Insert("type" , "BETWEEN");
|
||||
FilterStructure2.Insert("value", "20 AND 50");
|
||||
FilterStructure2.Insert("raw" , True);
|
||||
|
||||
Filters.Add(FilterStructure1);
|
||||
Filters.Add(FilterStructure2);
|
||||
|
||||
Sort = New Structure("ip_address", "DESC");
|
||||
Count = 5;
|
||||
|
||||
Result = OPI_PostgreSQL.GetRecords(Table
|
||||
, Fields
|
||||
, Filters
|
||||
, Sort
|
||||
, Count
|
||||
, ConnectionString
|
||||
, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres GetRecords \
|
||||
--table "testtable" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres GetRecords ^
|
||||
--table "testtable" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"bigint_field": 9999999,
|
||||
"bigserial_field": 9999999,
|
||||
"bool_field": true,
|
||||
"bytea_field": {
|
||||
"BYTEA": "/9j/4VTBRX..."
|
||||
},
|
||||
"char_field": "A",
|
||||
"charn_field": "AAA",
|
||||
"date_field": "2026-02-20",
|
||||
"dp_field": 1.0002,
|
||||
"int_field": 100,
|
||||
"ip_field": "127.0.0.1",
|
||||
"json_field": {
|
||||
"key": "***",
|
||||
"value": 10
|
||||
},
|
||||
"jsonb_field": {
|
||||
"key": "***",
|
||||
"value": 10
|
||||
},
|
||||
"name_field": "Vitaly",
|
||||
"numeric_field": "15.20",
|
||||
"oid_field": 24576,
|
||||
"oldchar_field": 1,
|
||||
"real_field": 15.1999998092651,
|
||||
"serial_field": 100,
|
||||
"smallint_field": 5,
|
||||
"smallserial_field": 6,
|
||||
"text_field": "Some text",
|
||||
"time_field": "12:59:34",
|
||||
"ts_field": "2026-02-20T12:59:34",
|
||||
"tswtz_field": "2026-02-20T13:59:34+03:00",
|
||||
"uuid_field": "98db495d-a9a8-4716-a5fb-b15a6d55ee7a",
|
||||
"varchar_field": "Some varchar"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Update records and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Update records
|
||||
Updates the value of records by selected criteria
|
||||
|
||||
|
||||
|
||||
`Function UpdateRecords(Val Table, Val ValueStructure, Val Filters = "", Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| ValueStructure | --values | Structure Of KeyAndValue | ✔ | Values structure: Key > field, Value > field value |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
Record data is specified as an array of structures of the following type:<br/>`{'Field name 1': {'Type': 'Value'}, 'Field name 2': {'Type': 'Value'},...}`
|
||||
|
||||
The list of available types is described on the initial page of the PostgreSQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "test_data";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "test_data";
|
||||
|
||||
FieldsStructure = New Structure;
|
||||
FieldsStructure.Insert("ip_address", New Structure("VARCHAR", "127.0.0.1"));
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "gender");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", New Structure("VARCHAR", "Male"));
|
||||
FilterStructure.Insert("raw" , False);
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQl.UpdateRecords(Table
|
||||
, FieldsStructure
|
||||
, FilterStructure
|
||||
, ConnectionString
|
||||
, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres UpdateRecords \
|
||||
--table "test_data" \
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" \
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false}]" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres UpdateRecords ^
|
||||
--table "test_data" ^
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" ^
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false}]" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Record management",
|
||||
"position": "5"
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Add table column and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add table column
|
||||
Adds a new column to an existing table
|
||||
|
||||
|
||||
|
||||
`Function AddTableColumn(Val Table, Val Name, Val DataType, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| DataType | --type | String | ✔ | Column data type |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
Name = "new_field";
|
||||
DataType = "TEXT";
|
||||
|
||||
Result = OPI_PostgreSQL.AddTableColumn(Table, Name, DataType, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres AddTableColumn \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--type "TEXT" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres AddTableColumn ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--type "TEXT" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Clear table and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Clear table
|
||||
Clears the database table
|
||||
|
||||
|
||||
|
||||
`Function ClearTable(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.ClearTable(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres ClearTable \
|
||||
--table "testtable" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres ClearTable ^
|
||||
--table "testtable" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,119 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Create table and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
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 = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
The list of available types is described on the initial page of the PostgreSQL library documentation
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
ColoumnsStruct = New Structure;
|
||||
ColoumnsStruct.Insert("bool_field" , "BOOL");
|
||||
ColoumnsStruct.Insert("oldchar_field" , """char""");
|
||||
ColoumnsStruct.Insert("smallint_field" , "SMALLINT");
|
||||
ColoumnsStruct.Insert("smallserial_field", "SMALLSERIAL");
|
||||
ColoumnsStruct.Insert("int_field" , "INT");
|
||||
ColoumnsStruct.Insert("serial_field" , "SERIAL");
|
||||
ColoumnsStruct.Insert("oid_field" , "OID");
|
||||
ColoumnsStruct.Insert("bigint_field" , "BIGINT");
|
||||
ColoumnsStruct.Insert("bigserial_field" , "BIGSERIAL");
|
||||
ColoumnsStruct.Insert("real_field" , "REAL");
|
||||
ColoumnsStruct.Insert("dp_field" , "DOUBLE PRECISION");
|
||||
ColoumnsStruct.Insert("text_field" , "TEXT");
|
||||
ColoumnsStruct.Insert("varchar_field" , "VARCHAR");
|
||||
ColoumnsStruct.Insert("charn_field" , "CHAR(3)");
|
||||
ColoumnsStruct.Insert("char_field" , "CHAR");
|
||||
ColoumnsStruct.Insert("name_field" , "NAME");
|
||||
ColoumnsStruct.Insert("bytea_field" , "BYTEA");
|
||||
ColoumnsStruct.Insert("ts_field" , "TIMESTAMP");
|
||||
ColoumnsStruct.Insert("tswtz_field" , "TIMESTAMP WITH TIME ZONE");
|
||||
ColoumnsStruct.Insert("ip_field" , "INET");
|
||||
ColoumnsStruct.Insert("json_field" , "JSON");
|
||||
ColoumnsStruct.Insert("jsonb_field" , "JSONB");
|
||||
ColoumnsStruct.Insert("date_field" , "DATE");
|
||||
ColoumnsStruct.Insert("time_field" , "TIME");
|
||||
ColoumnsStruct.Insert("uuid_field" , "UUID");
|
||||
ColoumnsStruct.Insert("numeric_field" , "NUMERIC(15, 2)");
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.CreateTable(Table, ColoumnsStruct, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres CreateTable \
|
||||
--table "somename" \
|
||||
--cols "{'bool_field':'BOOL','oldchar_field':'\"char\"','smallint_field':'SMALLINT','smallserial_field':'SMALLSERIAL','int_field':'INT','serial_field':'SERIAL','oid_field':'OID','bigint_field':'BIGINT','bigserial_field':'BIGSERIAL','real_field':'REAL','dp_field':'DOUBLE PRECISION','text_field':'TEXT','varchar_field':'VARCHAR','charn_field':'CHAR(3)','char_field':'CHAR','name_field':'NAME','bytea_field':'BYTEA','ts_field':'TIMESTAMP','tswtz_field':'TIMESTAMP WITH TIME ZONE','ip_field':'INET','json_field':'JSON','jsonb_field':'JSONB','date_field':'DATE','time_field':'TIME','uuid_field':'UUID','numeric_field':'NUMERIC(15, 2)','wtf_field':'WTF'}" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres CreateTable ^
|
||||
--table "somename" ^
|
||||
--cols "{'bool_field':'BOOL','oldchar_field':'\"char\"','smallint_field':'SMALLINT','smallserial_field':'SMALLSERIAL','int_field':'INT','serial_field':'SERIAL','oid_field':'OID','bigint_field':'BIGINT','bigserial_field':'BIGSERIAL','real_field':'REAL','dp_field':'DOUBLE PRECISION','text_field':'TEXT','varchar_field':'VARCHAR','charn_field':'CHAR(3)','char_field':'CHAR','name_field':'NAME','bytea_field':'BYTEA','ts_field':'TIMESTAMP','tswtz_field':'TIMESTAMP WITH TIME ZONE','ip_field':'INET','json_field':'JSON','jsonb_field':'JSONB','date_field':'DATE','time_field':'TIME','uuid_field':'UUID','numeric_field':'NUMERIC(15, 2)','wtf_field':'WTF'}" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Delete table column and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table column
|
||||
Deletes a column from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteTableColumn(Val Table, Val Name, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
Name = "new_field";
|
||||
|
||||
Result = OPI_PostgreSQL.DeleteTableColumn(Table, Name, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteTableColumn \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteTableColumn ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
description: Delete table and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table
|
||||
Deletes a table from the database
|
||||
|
||||
|
||||
|
||||
`Function DeleteTable(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.DeleteTable(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteTable \
|
||||
--table "test_data" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres DeleteTable ^
|
||||
--table "test_data" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Ensure table and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure table
|
||||
Creates a new table if it does not exist or updates the composition of columns in an existing table
|
||||
|
||||
|
||||
|
||||
`Function EnsureTable(Val Table, Val ColoumnsStruct, Val Connection = "", Val Tls = "") 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 | --dbc | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
As a result of changing the table structure, data may be lost! It is recommended to test this method on test data beforehand
|
||||
|
||||
This function does not update the data type of existing columns
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
ColoumnsStruct = New Structure;
|
||||
ColoumnsStruct.Insert("smallint_field" , "SMALLINT");
|
||||
ColoumnsStruct.Insert("uuid_field" , "uuid");
|
||||
ColoumnsStruct.Insert("bigint_field" , "BIGINT");
|
||||
ColoumnsStruct.Insert("custom_field" , "TEXT");
|
||||
|
||||
Result = OPI_PostgreSQL.EnsureTable(Table, ColoumnsStruct, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres EnsureTable \
|
||||
--table "test_new" \
|
||||
--cols "{'smallint_field':'SMALLINT','uuid_field':'uuid','bigint_field':'BIGINT','custom_field':'TEXT'}" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres EnsureTable ^
|
||||
--table "test_new" ^
|
||||
--cols "{'smallint_field':'SMALLINT','uuid_field':'uuid','bigint_field':'BIGINT','custom_field':'TEXT'}" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true,
|
||||
"commit": {
|
||||
"result": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,232 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Get table information and other functions to work with PostgreSQL in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, PostgreSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get table information
|
||||
Gets information about the table
|
||||
|
||||
|
||||
|
||||
`Function GetTableInformation(Val Table, Val Connection = "", Val Tls = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --dbc | String, Arbitrary | ✖ | Connection or connection string |
|
||||
| Tls | --tls | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Address = "127.0.0.1";
|
||||
Login = "bayselonarrend";
|
||||
Password = "12we...";
|
||||
Base = "testbase1";
|
||||
|
||||
TLS = True;
|
||||
Port = 5432;
|
||||
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
||||
|
||||
If TLS Then
|
||||
TLSSettings = OPI_PostgreSQL.GetTLSSettings(True);
|
||||
Else
|
||||
TLSSettings = Undefined;
|
||||
EndIf;
|
||||
|
||||
Table = "testtable";
|
||||
|
||||
// When using the connection string, a new connection is initialised,
|
||||
// which will be closed after the function is executed.
|
||||
// If several operations are performed, it is desirable to use one connection,
|
||||
// previously created by the CreateConnection function()
|
||||
Result = OPI_PostgreSQL.GetTableInformation(Table, ConnectionString, TLSSettings);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres GetTableInformation \
|
||||
--table "test_new" \
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint postgres GetTableInformation ^
|
||||
--table "test_new" ^
|
||||
--dbc "postgresql://bayselonarrend:***@127.0.0.1:5432/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "bool_field",
|
||||
"data_type": "boolean",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "oldchar_field",
|
||||
"data_type": "\"char\"",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "smallint_field",
|
||||
"data_type": "smallint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": "nextval('testtable_smallserial_field_seq'::regclass)",
|
||||
"column_name": "smallserial_field",
|
||||
"data_type": "smallint",
|
||||
"is_nullable": "NO"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "int_field",
|
||||
"data_type": "integer",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": "nextval('testtable_serial_field_seq'::regclass)",
|
||||
"column_name": "serial_field",
|
||||
"data_type": "integer",
|
||||
"is_nullable": "NO"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "oid_field",
|
||||
"data_type": "oid",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "bigint_field",
|
||||
"data_type": "bigint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": "nextval('testtable_bigserial_field_seq'::regclass)",
|
||||
"column_name": "bigserial_field",
|
||||
"data_type": "bigint",
|
||||
"is_nullable": "NO"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "real_field",
|
||||
"data_type": "real",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "dp_field",
|
||||
"data_type": "double precision",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "jsonb_field",
|
||||
"data_type": "jsonb",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "date_field",
|
||||
"data_type": "date",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "time_field",
|
||||
"data_type": "time without time zone",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "uuid_field",
|
||||
"data_type": "uuid",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "numeric_field",
|
||||
"data_type": "numeric",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "bytea_field",
|
||||
"data_type": "bytea",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "ts_field",
|
||||
"data_type": "timestamp without time zone",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "tswtz_field",
|
||||
"data_type": "timestamp with time zone",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "ip_field",
|
||||
"data_type": "inet",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "json_field",
|
||||
"data_type": "json",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
...
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Table management",
|
||||
"position": "4"
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Add rows and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add rows
|
||||
Adds new rows to the table
|
||||
|
||||
|
||||
|
||||
`Function AddRecords(Val Table, Val DataArray, Val Transaction = True, Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
Binary data can also be transferred as a structure `{'blob':File path}`
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Image = "https://hut.openintegrations.dev/test_data/picture.jpg";
|
||||
OPI_TypeConversion.GetBinaryData(Image); // Image - Type: BinaryData
|
||||
|
||||
PictureFile = GetTempFileName("png");
|
||||
Image.Write(PictureFile); // PictureFile - File to disk
|
||||
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test";
|
||||
|
||||
DataArray = New Array;
|
||||
|
||||
RowStructure2 = New Structure;
|
||||
RowStructure2.Insert("name" , "Vitaly"); // TEXT
|
||||
RowStructure2.Insert("age" , 25); // INTEGER
|
||||
RowStructure2.Insert("salary" , 1000.12); // REAL
|
||||
RowStructure2.Insert("is_active" , True); // BOOL
|
||||
RowStructure2.Insert("created_at", OPI_Tools.GetCurrentDate()); // DATETIME
|
||||
RowStructure2.Insert("data" , New Structure("blob", Image)); // BLOB
|
||||
|
||||
RowStructure1 = New Structure;
|
||||
RowStructure1.Insert("name" , "Lesha"); // TEXT
|
||||
RowStructure1.Insert("age" , 20); // INTEGER
|
||||
RowStructure1.Insert("salary" , 200.20); // REAL
|
||||
RowStructure1.Insert("is_active" , False); // BOOL
|
||||
RowStructure1.Insert("created_at", OPI_Tools.GetCurrentDate()); // DATETIME
|
||||
RowStructure1.Insert("data" , New Structure("blob", PictureFile)); // BLOB
|
||||
|
||||
DataArray.Add(RowStructure2);
|
||||
DataArray.Add(RowStructure1);
|
||||
|
||||
Result = OPI_SQLite.AddRecords(Table, DataArray, , Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint sqlite AddRecords \
|
||||
--table "test1" \
|
||||
--rows "{'[An obscure column]':'yo'}" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.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 AddRecords ^
|
||||
--table "test1" ^
|
||||
--rows "{'[An obscure column]':'yo'}" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"commit": {
|
||||
"result": true
|
||||
},
|
||||
"result": true,
|
||||
"rows": 2,
|
||||
"errors": []
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,78 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Delete records and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete records
|
||||
Deletes records from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteRecords(Val Table, Val Filters = "", Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test";
|
||||
|
||||
Filters = New Array;
|
||||
|
||||
FilterStructure = New Structure;
|
||||
|
||||
FilterStructure.Insert("field", "name");
|
||||
FilterStructure.Insert("type" , "=");
|
||||
FilterStructure.Insert("value", "Vitaly A.");
|
||||
FilterStructure.Insert("union", "AND");
|
||||
FilterStructure.Insert("raw" , False);
|
||||
|
||||
Filters.Add(FilterStructure);
|
||||
|
||||
Result = OPI_SQLite.DeleteRecords(Table, FilterStructure, Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint sqlite DeleteRecords \
|
||||
--table "test" \
|
||||
--filter "{'field':'name','type':'=','value':'Vitaly A.','union':'AND','raw':false}" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.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 DeleteRecords ^
|
||||
--table "test" ^
|
||||
--filter "{'field':'name','type':'=','value':'Vitaly A.','union':'AND','raw':false}" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Ensure records and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure records
|
||||
Adds records or updates data of existing ones when key fields match
|
||||
|
||||
|
||||
|
||||
`Function EnsureRecords(Val Table, Val DataArray, Val KeyFields = "", Val Transaction = True, Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| DataArray | --rows | Array of Structure | ✔ | An array of string data structures: Key > field, Value > field value |
|
||||
| KeyFields | --unique | Array Of String | ✖ | Name or names of key table fields for uniqueness validation |
|
||||
| Transaction | --trn | Boolean | ✖ | True > adding records to transactions with rollback on error |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
UNIQUE and PRIMARY KEY fields can be specified as key fields. If fields are not specified, uniqueness is determined by all suitable fields
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test_merge";
|
||||
|
||||
DataArray = New Array;
|
||||
|
||||
RowStructure2 = New Structure;
|
||||
RowStructure2.Insert("id" , 1);
|
||||
RowStructure2.Insert("name" , "Vitaly");
|
||||
RowStructure2.Insert("age" , 25);
|
||||
RowStructure2.Insert("salary", 1000.12);
|
||||
|
||||
RowStructure1 = New Structure;
|
||||
RowStructure1.Insert("id" , 2);
|
||||
RowStructure1.Insert("name" , "Lesha");
|
||||
RowStructure1.Insert("age" , 20);
|
||||
RowStructure1.Insert("salary", 200.20);
|
||||
|
||||
DataArray.Add(RowStructure2);
|
||||
DataArray.Add(RowStructure1);
|
||||
|
||||
KeyFields = New Array;
|
||||
KeyFields.Add("id");
|
||||
|
||||
Result = OPI_SQLite.EnsureRecords(Table, DataArray, KeyFields, , Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint sqlite EnsureRecords \
|
||||
--table "test_merge" \
|
||||
--rows "[{'id':'1','name':'Vitaly Updated','age':'25','salary':'1500.5'},{'id':'3','name':'Anton','age':'30','salary':'3000'}]" \
|
||||
--unique "['id']" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.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 EnsureRecords ^
|
||||
--table "test_merge" ^
|
||||
--rows "[{'id':'1','name':'Vitaly Updated','age':'25','salary':'1500.5'},{'id':'3','name':'Anton','age':'30','salary':'3000'}]" ^
|
||||
--unique "['id']" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Get records filter Structure and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records filter Structure
|
||||
Gets the template structure for filtering records in ORM queries
|
||||
|
||||
|
||||
|
||||
`Function GetRecordsFilterStructure(Val Clear = False) Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Clear | --empty | Boolean | ✖ | True > structure with empty valuse, False > field descriptions at values |
|
||||
|
||||
|
||||
Returns: Structure Of KeyAndValue - Record filter element
|
||||
|
||||
:::tip
|
||||
The use of the `raw` feature is necessary for compound constructions like `BETWEEN`. For example: with `raw:false` the filter `type:BETWEEN` `value:10 AND 20` will be interpolated as `BETWEEN ?1 ` where `?1 = "10 AND 20,"' which would cause an error.. In such a case, you must use `raw:true` to set the condition directly in the query text
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Result = OPI_SQLite.GetRecordsFilterStructure();
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint sqlite GetRecordsFilterStructure \
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint sqlite GetRecordsFilterStructure ^
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"field": "<filtering field name>",
|
||||
"type": "<comparison type>",
|
||||
"value": "<comparison value>",
|
||||
"union": "<connection with the following condition: AND, OR, etc..>",
|
||||
"raw": "<true - the value will be inserted by text as it is, false - through the parameter>"
|
||||
}
|
||||
```
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Get records and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get records
|
||||
Gets records from the selected table
|
||||
|
||||
|
||||
|
||||
`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
|
||||
|
||||
:::tip
|
||||
Values of the Binary data type (BLOB) are returned as `{'blob':Base64 string}`
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="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);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint sqlite GetRecords \
|
||||
--table "test" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint sqlite GetRecords ^
|
||||
--table "test" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"name": "Vitaly",
|
||||
"salary": 1000.12
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Update records and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Update records
|
||||
Updates the value of records by selected criteria
|
||||
|
||||
|
||||
|
||||
`Function UpdateRecords(Val Table, Val ValueStructure, Val Filters = "", Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| ValueStructure | --values | Structure Of KeyAndValue | ✔ | Values structure: Key > field, Value > field value |
|
||||
| Filters | --filter | Array of Structure | ✖ | Filters array. See GetRecordsFilterStructure |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="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);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# 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 "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.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 UpdateRecords ^
|
||||
--table "test" ^
|
||||
--values "{'name':'Vitaly A.','salary':'999999'}" ^
|
||||
--filter "{'field':'name','type':'=','value':'Vitaly','union':'AND','raw':false}" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Record management",
|
||||
"position": "4"
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Add table column and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Add table column
|
||||
Adds a new column to an existing table
|
||||
|
||||
|
||||
|
||||
`Function AddTableColumn(Val Table, Val Name, Val DataType, Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| DataType | --type | String | ✔ | Column data type |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test";
|
||||
Name = "new_col";
|
||||
DataType = "TEXT";
|
||||
|
||||
Result = OPI_SQLite.AddTableColumn(Table, Name, DataType, Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint sqlite AddTableColumn \
|
||||
--table "test" \
|
||||
--name "new_col" \
|
||||
--type "TEXT" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint sqlite AddTableColumn ^
|
||||
--table "test" ^
|
||||
--name "new_col" ^
|
||||
--type "TEXT" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
description: Clear table and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Clear table
|
||||
Clears the database table
|
||||
|
||||
|
||||
|
||||
`Function ClearTable(Val Table, Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test";
|
||||
|
||||
Result = OPI_SQLite.ClearTable(Table, Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint sqlite ClearTable \
|
||||
--table "test" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint sqlite ClearTable ^
|
||||
--table "test" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,75 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Create table and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
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 |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.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);
|
||||
```
|
||||
|
||||
|
||||
<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 "test1" \
|
||||
--cols "{'id':'INTEGER PRIMARY KEY','[An obscure column]':'TEXT'}" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.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 "test1" ^
|
||||
--cols "{'id':'INTEGER PRIMARY KEY','[An obscure column]':'TEXT'}" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Delete table column and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table column
|
||||
Deletes a column from the table
|
||||
|
||||
|
||||
|
||||
`Function DeleteTableColumn(Val Table, Val Name, Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Name | --name | String | ✔ | Column name |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test";
|
||||
Name = "new_col";
|
||||
|
||||
Result = OPI_SQLite.DeleteTableColumn(Table, Name, Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint sqlite DeleteTableColumn \
|
||||
--table "test" \
|
||||
--name "new_col" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint sqlite DeleteTableColumn ^
|
||||
--table "test" ^
|
||||
--name "new_col" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Delete table and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Delete table
|
||||
Deletes a table from the database
|
||||
|
||||
|
||||
|
||||
`Function DeleteTable(Val Table, Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test";
|
||||
|
||||
Result = OPI_SQLite.DeleteTable(Table, Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint sqlite DeleteTable \
|
||||
--table "test" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint sqlite DeleteTable ^
|
||||
--table "test" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Ensure table and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Ensure table
|
||||
Creates a new table if it does not exist or updates the composition of columns in an existing table
|
||||
|
||||
|
||||
|
||||
`Function EnsureTable(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 |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
:::tip
|
||||
As a result of changing the table structure, data may be lost! It is recommended to test this method on test data beforehand
|
||||
|
||||
This function does not update the data type of existing columns
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
|
||||
Table = "test";
|
||||
|
||||
ColoumnsStruct = New Structure;
|
||||
ColoumnsStruct.Insert("id" , "INTEGER");
|
||||
ColoumnsStruct.Insert("code" , "INTEGER");
|
||||
ColoumnsStruct.Insert("name" , "TEXT");
|
||||
ColoumnsStruct.Insert("age" , "INTEGER");
|
||||
ColoumnsStruct.Insert("info" , "TEXT");
|
||||
|
||||
Result = OPI_SQLite.EnsureTable(Table, ColoumnsStruct, Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON data can also be passed as a path to a .json file
|
||||
|
||||
oint sqlite EnsureTable \
|
||||
--table "test_new" \
|
||||
--cols "{'id':'INTEGER','code':'INTEGER','name':'TEXT','age':'INTEGER','info':'TEXT'}" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.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 EnsureTable ^
|
||||
--table "test_new" ^
|
||||
--cols "{'id':'INTEGER','code':'INTEGER','name':'TEXT','age':'INTEGER','info':'TEXT'}" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"result": true,
|
||||
"commit": {
|
||||
"result": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,117 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Get table information and other functions to work with SQLite in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
||||
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, SQLite]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Get table information
|
||||
Gets information about the table
|
||||
|
||||
|
||||
|
||||
`Function GetTableInformation(Val Table, Val Connection = "") Export`
|
||||
|
||||
| Parameter | CLI option | Type | Required | Description |
|
||||
|-|-|-|-|-|
|
||||
| Table | --table | String | ✔ | Table name |
|
||||
| Connection | --db | String, Arbitrary | ✖ | Existing connection or database path |
|
||||
|
||||
|
||||
Returns: Map Of KeyAndValue - Result of query execution
|
||||
|
||||
|
||||
|
||||
```bsl title="1C:Enterprise/OneScript code example"
|
||||
Base = "/tmp/vnnmoosn.qqb.sqlite";
|
||||
Table = "test";
|
||||
|
||||
Result = OPI_SQLite.GetTableInformation(Table, Base);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint sqlite GetTableInformation \
|
||||
--table "test" \
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint sqlite GetTableInformation ^
|
||||
--table "test" ^
|
||||
--db "C:\Users\bayse\AppData\Local\Temp\lezmyh51.mot.sqlite"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Result"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"cid": 0,
|
||||
"dflt_value": null,
|
||||
"name": "id",
|
||||
"notnull": 0,
|
||||
"pk": 1,
|
||||
"type": "INTEGER"
|
||||
},
|
||||
{
|
||||
"cid": 1,
|
||||
"dflt_value": null,
|
||||
"name": "name",
|
||||
"notnull": 0,
|
||||
"pk": 0,
|
||||
"type": "TEXT"
|
||||
},
|
||||
{
|
||||
"cid": 2,
|
||||
"dflt_value": null,
|
||||
"name": "age",
|
||||
"notnull": 0,
|
||||
"pk": 0,
|
||||
"type": "INTEGER"
|
||||
},
|
||||
{
|
||||
"cid": 3,
|
||||
"dflt_value": null,
|
||||
"name": "salary",
|
||||
"notnull": 0,
|
||||
"pk": 0,
|
||||
"type": "REAL"
|
||||
},
|
||||
{
|
||||
"cid": 4,
|
||||
"dflt_value": null,
|
||||
"name": "is_active",
|
||||
"notnull": 0,
|
||||
"pk": 0,
|
||||
"type": "BOOLEAN"
|
||||
},
|
||||
{
|
||||
"cid": 5,
|
||||
"dflt_value": null,
|
||||
"name": "created_at",
|
||||
"notnull": 0,
|
||||
"pk": 0,
|
||||
"type": "DATETIME"
|
||||
},
|
||||
{
|
||||
"cid": 6,
|
||||
"dflt_value": null,
|
||||
"name": "data",
|
||||
"notnull": 0,
|
||||
"pk": 0,
|
||||
"type": "BLOB"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Table management",
|
||||
"position": "3"
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Создать базу данных и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Создать базу данных
|
||||
Создает базу данных с указанным именем
|
||||
|
||||
|
||||
|
||||
`Функция СоздатьБазуДанных(Знач База, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| База | --base | Строка | ✔ | Имя базы |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, , Логин, Пароль);
|
||||
|
||||
База = "testbase1";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.СоздатьБазуДанных(База, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql СоздатьБазуДанных \
|
||||
--base "testbase2" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql СоздатьБазуДанных ^
|
||||
--base "testbase2" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Удалить базу данных и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Удалить базу данных
|
||||
Удаляет базу данных
|
||||
|
||||
|
||||
|
||||
`Функция УдалитьБазуДанных(Знач База, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| База | --base | Строка | ✔ | Имя базы |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, , Логин, Пароль);
|
||||
|
||||
База = "testbase1";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.УдалитьБазуДанных(База, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьБазуДанных \
|
||||
--base "testbase2" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьБазуДанных ^
|
||||
--base "testbase2" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true,'ca_cert_path':''}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Управление базами данных",
|
||||
"position": "3"
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Добавить записи и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Добавить записи
|
||||
Добавляет записи в таблицу
|
||||
|
||||
|
||||
|
||||
`Функция ДобавитьЗаписи(Знач Таблица, Знач МассивДанных, Знач Транзакция = Истина, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| МассивДанных | --rows | Массив Из Структура | ✔ | Массив структур данных строк: Ключ > поле, Значение > значение поля |
|
||||
| Транзакция | --trn | Булево | ✖ | Истина > добавление записей в транзакции с откатом при ошибке |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
:::tip
|
||||
Данные записей указываются как массив структур вида:<br/>`{'Имя поля 1': {'Тип данных': 'Значение'}, 'Имя поля 2': {'Тип данных': 'Значение'},...}`
|
||||
|
||||
Список доступных типов описан на начальной странице документации библиотеки MSSQL
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "testtable";
|
||||
МассивЗаписей = Новый Массив;
|
||||
|
||||
Картинка = "https://hut.openintegrations.dev/test_data/picture.jpg";
|
||||
OPI_ПреобразованиеТипов.ПолучитьДвоичныеДанные(Картинка); // Картинка - Тип: ДвоичныеДанные
|
||||
|
||||
XML = "<?xml version=""1.0""?><root>
|
||||
| <element>
|
||||
| <name>Пример</name>
|
||||
| <value>123</value>
|
||||
| </element>
|
||||
| <element>
|
||||
| <name>Тест</name>
|
||||
| <value>456</value>
|
||||
| </element>
|
||||
|</root>";
|
||||
|
||||
ТекущаяДата = OPI_Инструменты.ПолучитьТекущуюДату();
|
||||
ТекущаяДатаЧП = OPI_Инструменты.ДатаRFC3339(ТекущаяДата, "+05:00");
|
||||
|
||||
СтруктураЗаписи = Новый Структура;
|
||||
СтруктураЗаписи.Вставить("tinyint_field" , Новый Структура("TINYINT" , 5));
|
||||
СтруктураЗаписи.Вставить("smallint_field" , Новый Структура("SMALLINT" , 2000));
|
||||
СтруктураЗаписи.Вставить("int_field" , Новый Структура("INT" , 200000));
|
||||
СтруктураЗаписи.Вставить("bigint_field" , Новый Структура("BIGINT" , 20000000000));
|
||||
СтруктураЗаписи.Вставить("float24_field" , Новый Структура("FLOAT24" , 10.1234567));
|
||||
СтруктураЗаписи.Вставить("float53_field" , Новый Структура("FLOAT53" , 10.123456789123456));
|
||||
СтруктураЗаписи.Вставить("bit_field" , Новый Структура("BIT" , Истина));
|
||||
СтруктураЗаписи.Вставить("nvarchar_field" , Новый Структура("NVARCHAR" , "Some text"));
|
||||
СтруктураЗаписи.Вставить("varbinary_field", Новый Структура("BYTES" , Картинка));
|
||||
СтруктураЗаписи.Вставить("uid_field" , Новый Структура("UUID" , Новый УникальныйИдентификатор));
|
||||
СтруктураЗаписи.Вставить("numeric_field" , Новый Структура("NUMERIC" , 5.333));
|
||||
СтруктураЗаписи.Вставить("xml_field" , Новый Структура("XML" , XML));
|
||||
СтруктураЗаписи.Вставить("date_field" , Новый Структура("DATE" , ТекущаяДата));
|
||||
СтруктураЗаписи.Вставить("time_field" , Новый Структура("TIME" , ТекущаяДата));
|
||||
СтруктураЗаписи.Вставить("dto_field" , Новый Структура("DATETIMEOFFSET", ТекущаяДатаЧП));
|
||||
СтруктураЗаписи.Вставить("datetime_field" , Новый Структура("DATETIME" , ТекущаяДата));
|
||||
|
||||
МассивЗаписей.Добавить(СтруктураЗаписи);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.ДобавитьЗаписи(Таблица, МассивЗаписей, Истина, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ДобавитьЗаписи \
|
||||
--table "testtable" \
|
||||
--rows "[{'tinyint_field':{'TINYINT':'5'},'smallint_field':{'SMALLINT':'2000'},'int_field':{'INT':'200000'},'bigint_field':{'BIGINT':'20000000000'},'float24_field':{'FLOAT24':'10.1234567'},'float53_field':{'FLOAT53':'10.1234567891235'},'bit_field':{'BIT':true},'nvarchar_field':{'NVARCHAR':'Some text'},'varbinary_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\aw3b0eye.f3f'},'uid_field':{'UUID':'4e278ef4-d1c7-4545-abb6-09e5a4863f85'},'numeric_field':{'NUMERIC':'5.333'},'xml_field':{'XML':'<?xml version=\"1.0\"?><root>\n <element>\n <name>Пример</name>\n <value>123</value>\n </element>\n <element>\n <name>Тест</name>\n <value>456</value>\n </element>\n</root>'},'date_field':{'DATE':'2/20/2026 1:07:29 AM'},'time_field':{'TIME':'2/20/2026 1:07:29 AM'},'dto_field':{'DATETIMEOFFSET':'2/19/2026 11:07:29 PM'},'datetime_field':{'DATETIME':'2/20/2026 1:07:29 AM'}}]" \
|
||||
--trn true \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ДобавитьЗаписи ^
|
||||
--table "testtable" ^
|
||||
--rows "[{'tinyint_field':{'TINYINT':'5'},'smallint_field':{'SMALLINT':'2000'},'int_field':{'INT':'200000'},'bigint_field':{'BIGINT':'20000000000'},'float24_field':{'FLOAT24':'10.1234567'},'float53_field':{'FLOAT53':'10.1234567891235'},'bit_field':{'BIT':true},'nvarchar_field':{'NVARCHAR':'Some text'},'varbinary_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\aw3b0eye.f3f'},'uid_field':{'UUID':'4e278ef4-d1c7-4545-abb6-09e5a4863f85'},'numeric_field':{'NUMERIC':'5.333'},'xml_field':{'XML':'<?xml version=\"1.0\"?><root>\n <element>\n <name>Пример</name>\n <value>123</value>\n </element>\n <element>\n <name>Тест</name>\n <value>456</value>\n </element>\n</root>'},'date_field':{'DATE':'2/20/2026 1:07:29 AM'},'time_field':{'TIME':'2/20/2026 1:07:29 AM'},'dto_field':{'DATETIMEOFFSET':'2/19/2026 11:07:29 PM'},'datetime_field':{'DATETIME':'2/20/2026 1:07:29 AM'}}]" ^
|
||||
--trn true ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"commit": {
|
||||
"result": true
|
||||
},
|
||||
"result": true,
|
||||
"rows": 1,
|
||||
"errors": []
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,101 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Удалить записи и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Удалить записи
|
||||
Удаляет записи из таблицы
|
||||
|
||||
|
||||
|
||||
`Функция УдалитьЗаписи(Знач Таблица, Знач Фильтры = "", Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Фильтры | --filter | Массив Из Структура | ✖ | Массив фильтров. См. [`ПолучитьСтруктуруФильтраЗаписей`](/docs/MSSQL/Record-management/Get-records-filter-structure) |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "test_data";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "test_data";
|
||||
|
||||
Фильтры = Новый Массив;
|
||||
|
||||
СтруктураФильтра = Новый Структура;
|
||||
|
||||
СтруктураФильтра.Вставить("field", "gender");
|
||||
СтруктураФильтра.Вставить("type" , "=");
|
||||
СтруктураФильтра.Вставить("value", Новый Структура("NVARCHAR", "Male"));
|
||||
СтруктураФильтра.Вставить("raw" , Ложь);
|
||||
СтруктураФильтра.Вставить("union", "AND");
|
||||
|
||||
Фильтры.Добавить(СтруктураФильтра);
|
||||
|
||||
СтруктураФильтра = Новый Структура;
|
||||
|
||||
СтруктураФильтра.Вставить("field", "ip_address");
|
||||
СтруктураФильтра.Вставить("type" , "=");
|
||||
СтруктураФильтра.Вставить("value", Новый Структура("NVARCHAR", "127.0.0.1"));
|
||||
СтруктураФильтра.Вставить("raw" , Ложь);
|
||||
|
||||
Фильтры.Добавить(СтруктураФильтра);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.УдалитьЗаписи(Таблица, Фильтры, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьЗаписи \
|
||||
--table "test_data" \
|
||||
--filter "[{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false,'union':'AND'},{'field':'ip_address','type':'=','value':{'NVARCHAR':'127.0.0.1'},'raw':false}]" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьЗаписи ^
|
||||
--table "test_data" ^
|
||||
--filter "[{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false,'union':'AND'},{'field':'ip_address','type':'=','value':{'NVARCHAR':'127.0.0.1'},'raw':false}]" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Гарантировать записи и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Гарантировать записи
|
||||
Добавляет записи или обновляет данные существующих при совпадении ключевых полей
|
||||
|
||||
|
||||
|
||||
`Функция ГарантироватьЗаписи(Знач Таблица, Знач МассивДанных, Знач КлючевыеПоля = "", Знач Транзакция = Истина, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| МассивДанных | --rows | Массив Из Структура | ✔ | Массив структур данных строк: Ключ > поле, Значение > значение поля |
|
||||
| КлючевыеПоля | --unique | Массив Из Строка | ✖ | Имя или имена ключевых полей таблицы для проверки уникальности |
|
||||
| Транзакция | --trn | Булево | ✖ | Истина > добавление записей в транзакции с откатом при ошибке |
|
||||
| Соединение | --db | Строка, Произвольный | ✖ | Существующее соединение или путь к базе |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "test_guarantee";
|
||||
|
||||
МассивДанных = Новый Массив;
|
||||
|
||||
СтруктураСтроки1 = Новый Структура;
|
||||
СтруктураСтроки1.Вставить("id" , Новый Структура("INT" , 1));
|
||||
СтруктураСтроки1.Вставить("name" , Новый Структура("NVARCHAR", "Vitaly"));
|
||||
СтруктураСтроки1.Вставить("age" , Новый Структура("INT" , 25));
|
||||
СтруктураСтроки1.Вставить("salary", Новый Структура("DECIMAL" , 1000.12));
|
||||
|
||||
СтруктураСтроки2 = Новый Структура;
|
||||
СтруктураСтроки2.Вставить("id" , Новый Структура("INT" , 2));
|
||||
СтруктураСтроки2.Вставить("name" , Новый Структура("NVARCHAR", "Lesha"));
|
||||
СтруктураСтроки2.Вставить("age" , Новый Структура("INT" , 20));
|
||||
СтруктураСтроки2.Вставить("salary", Новый Структура("DECIMAL" , 200.20));
|
||||
|
||||
МассивДанных.Добавить(СтруктураСтроки1);
|
||||
МассивДанных.Добавить(СтруктураСтроки2);
|
||||
|
||||
КлючевыеПоля = Новый Массив;
|
||||
КлючевыеПоля.Добавить("id");
|
||||
|
||||
Результат = OPI_MSSQL.ГарантироватьЗаписи(Таблица, МассивДанных, КлючевыеПоля, , СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ГарантироватьЗаписи \
|
||||
--table "test_guarantee" \
|
||||
--rows "[{'id':{'INT':'1'},'name':{'NVARCHAR':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DECIMAL':'1500.5'}},{'id':{'INT':'3'},'name':{'NVARCHAR':'Anton'},'age':{'INT':'30'},'salary':{'DECIMAL':'3000'}}]" \
|
||||
--unique "['id']" \
|
||||
--db "Server=127.0.0.1;Database=testbase1;User Id=SA;Password="12we3456!2154";" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ГарантироватьЗаписи ^
|
||||
--table "test_guarantee" ^
|
||||
--rows "[{'id':{'INT':'1'},'name':{'NVARCHAR':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DECIMAL':'1500.5'}},{'id':{'INT':'3'},'name':{'NVARCHAR':'Anton'},'age':{'INT':'30'},'salary':{'DECIMAL':'3000'}}]" ^
|
||||
--unique "['id']" ^
|
||||
--db "Server=127.0.0.1;Database=testbase1;User Id=SA;Password="12we3456!2154";" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Получить структуру фильтра записей и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Получить структуру фильтра записей
|
||||
Получает структуру шаблон для фильтрации записей в запросах ORM
|
||||
|
||||
|
||||
|
||||
`Функция ПолучитьСтруктуруФильтраЗаписей(Знач Пустая = Ложь) Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Пустая | --empty | Булево | ✖ | Истина > структура с пустыми значениями, Ложь > в значениях будут описания полей |
|
||||
|
||||
|
||||
Возвращаемое значение: Структура Из КлючИЗначение - Элемент фильтра записей
|
||||
|
||||
:::tip
|
||||
Использование признака `raw` необходимо для составных конструкций, вроде `BETWEEN`. Например: при `raw:false` фильтр `type:BETWEEN` `value:10 AND 20` будет интерпретирован как `BETWEEN ?1 ` где `?1 = "10 AND 20"`, что приведет к ошибке. В таком случае необходимо использовать `raw:true` для установки условия напрямую в текст запроса
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Результат = OPI_MSSQL.ПолучитьСтруктуруФильтраЗаписей();
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint mssql ПолучитьСтруктуруФильтраЗаписей \
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint mssql ПолучитьСтруктуруФильтраЗаписей ^
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"field": "<имя поля для отбора>",
|
||||
"type": "<тип сравнения>",
|
||||
"value": "<значение для сравнения>",
|
||||
"union": "<связь со следующим условием: AND, OR и пр.>",
|
||||
"raw": "<истина - значение будет вставлено текстом, как есть, ложь - через параметр>"
|
||||
}
|
||||
```
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Получить записи и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Получить записи
|
||||
Получает записи из выбранной таблицы
|
||||
|
||||
|
||||
|
||||
`Функция ПолучитьЗаписи(Знач Таблица, Знач Поля = "*", Знач Фильтры = "", Знач Сортировка = "", Знач Количество = "", Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Поля | --fields | Массив Из Строка | ✖ | Поля для выборки |
|
||||
| Фильтры | --filter | Массив Из Структура | ✖ | Массив фильтров. См. [`ПолучитьСтруктуруФильтраЗаписей`](/docs/MSSQL/Record-management/Get-records-filter-structure) |
|
||||
| Сортировка | --order | Структура Из КлючИЗначение | ✖ | Сортировка: Ключ > поле, Значение > направление (ASC, DESC) |
|
||||
| Количество | --limit | Число | ✖ | Ограничение количества получаемых строк |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
// Все записи без отборов
|
||||
|
||||
Таблица = "testtable";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.ПолучитьЗаписи(Таблица, , , , , СтрокаПодключения, НастройкиTLS);
|
||||
|
||||
// Отборы, выбранные поля, количество и сортировка
|
||||
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, "test_data", Логин, Пароль);
|
||||
|
||||
Таблица = "test_data";
|
||||
|
||||
Поля = Новый Массив;
|
||||
Поля.Добавить("first_name");
|
||||
Поля.Добавить("last_name");
|
||||
Поля.Добавить("email");
|
||||
|
||||
Фильтры = Новый Массив;
|
||||
|
||||
СтруктураФильтра1 = Новый Структура;
|
||||
|
||||
СтруктураФильтра1.Вставить("field", "gender");
|
||||
СтруктураФильтра1.Вставить("type" , "=");
|
||||
СтруктураФильтра1.Вставить("value", "Male");
|
||||
СтруктураФильтра1.Вставить("union", "AND");
|
||||
СтруктураФильтра1.Вставить("raw" , Ложь);
|
||||
|
||||
СтруктураФильтра2 = Новый Структура;
|
||||
|
||||
СтруктураФильтра2.Вставить("field", "id");
|
||||
СтруктураФильтра2.Вставить("type" , "BETWEEN");
|
||||
СтруктураФильтра2.Вставить("value", "20 AND 50");
|
||||
СтруктураФильтра2.Вставить("raw" , Истина);
|
||||
|
||||
Фильтры.Добавить(СтруктураФильтра1);
|
||||
Фильтры.Добавить(СтруктураФильтра2);
|
||||
|
||||
Сортировка = Новый Структура("ip_address", "DESC");
|
||||
Количество = 5;
|
||||
|
||||
Результат = OPI_MSSQL.ПолучитьЗаписи(Таблица, Поля, Фильтры, Сортировка, Количество, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ПолучитьЗаписи \
|
||||
--table "testtable" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ПолучитьЗаписи ^
|
||||
--table "testtable" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"bigint_field": 20000000000,
|
||||
"bit_field": 1,
|
||||
"date_field": "2026-02-20",
|
||||
"datetime_field": "2026-02-20T11:46:26",
|
||||
"dto_field": "2026-02-20T01:46:26+00:00",
|
||||
"float24_field": 10.1234569549561,
|
||||
"float53_field": 10.1234567891235,
|
||||
"int_field": 200000,
|
||||
"numeric_field": 5.333,
|
||||
"nvarchar_field": "Some text",
|
||||
"smallint_field": 2000,
|
||||
"time_field": "11:46:26",
|
||||
"tinyint_field": 5,
|
||||
"uid_field": "1fcec8ca-49e8-4747-9548-dfcbb1abb5a3",
|
||||
"varbinary_field": {
|
||||
"BYTES": "/9j/4VTBRX..."
|
||||
},
|
||||
"xml_field": "<root><element><name>Пример</name><value>123</value></element><element><name>Тест</name><value>456</value></element></root>"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Обновить записи и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Обновить записи
|
||||
Обновляет значение записей по выбранным критериям
|
||||
|
||||
|
||||
|
||||
`Функция ОбновитьЗаписи(Знач Таблица, Знач СтруктураЗначений, Знач Фильтры = "", Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| СтруктураЗначений | --values | Структура Из КлючИЗначение | ✔ | Структура значений: Ключ > поле, Значение > значение поля |
|
||||
| Фильтры | --filter | Массив Из Структура | ✖ | Массив фильтров. См. [`ПолучитьСтруктуруФильтраЗаписей`](/docs/MSSQL/Record-management/Get-records-filter-structure) |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
:::tip
|
||||
Данные записей указываются как массив структур вида:<br/>`{'Имя поля 1': {'Тип данных': 'Значение'}, 'Имя поля 2': {'Тип данных': 'Значение'},...}`
|
||||
|
||||
Список доступных типов описан на начальной странице документации библиотеки MSSQL
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "test_data";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "test_data";
|
||||
|
||||
СтруктураПолей = Новый Структура;
|
||||
СтруктураПолей.Вставить("ip_address", Новый Структура("VARCHAR", "127.0.0.1"));
|
||||
|
||||
Фильтры = Новый Массив;
|
||||
|
||||
СтруктураФильтра = Новый Структура;
|
||||
|
||||
СтруктураФильтра.Вставить("field", "gender");
|
||||
СтруктураФильтра.Вставить("type" , "=");
|
||||
СтруктураФильтра.Вставить("value", Новый Структура("NVARCHAR", "Male"));
|
||||
СтруктураФильтра.Вставить("raw" , Ложь);
|
||||
|
||||
Фильтры.Добавить(СтруктураФильтра);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.ОбновитьЗаписи(Таблица, СтруктураПолей, СтруктураФильтра, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ОбновитьЗаписи \
|
||||
--table "test_data" \
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" \
|
||||
--filter "{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false}" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ОбновитьЗаписи ^
|
||||
--table "test_data" ^
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" ^
|
||||
--filter "{'field':'gender','type':'=','value':{'NVARCHAR':'Male'},'raw':false}" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Работа с записями",
|
||||
"position": "5"
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Добавить колонку таблицы и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Добавить колонку таблицы
|
||||
Добавляет новую колонку в существующую таблицу
|
||||
|
||||
|
||||
|
||||
`Функция ДобавитьКолонкуТаблицы(Знач Таблица, Знач Имя, Знач ТипДанных, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Имя | --name | Строка | ✔ | Имя колонки |
|
||||
| ТипДанных | --type | Строка | ✔ | Тип данных колонки |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
|
||||
База = "testbase1";
|
||||
Таблица = "testtable";
|
||||
Имя = "new_field";
|
||||
ТипДанных = "bigint";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.ДобавитьКолонкуТаблицы(Таблица, Имя, ТипДанных, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ДобавитьКолонкуТаблицы \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--type "bigint" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ДобавитьКолонкуТаблицы ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--type "bigint" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Очистить таблицу и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Очистить таблицу
|
||||
Очищает таблицу базы
|
||||
|
||||
|
||||
|
||||
`Функция ОчиститьТаблицу(Знач Таблица, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "testtable";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.ОчиститьТаблицу(Таблица, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ОчиститьТаблицу \
|
||||
--table "testtable" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ОчиститьТаблицу ^
|
||||
--table "testtable" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Создать таблицу и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Создать таблицу
|
||||
Создает пустую таблицу в базе
|
||||
|
||||
|
||||
|
||||
`Функция СоздатьТаблицу(Знач Таблица, Знач СтруктураКолонок, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| СтруктураКолонок | --cols | Структура Из КлючИЗначение | ✔ | Структура колонок: Ключ > имя, Значение > Тип данных |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
:::tip
|
||||
Список доступных типов описан на начальной странице документации библиотеки MSSQL
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "testtable";
|
||||
|
||||
СтруктураКолонок = Новый Структура;
|
||||
СтруктураКолонок.Вставить("tinyint_field" , "tinyint");
|
||||
СтруктураКолонок.Вставить("smallint_field" , "smallint");
|
||||
СтруктураКолонок.Вставить("int_field" , "int");
|
||||
СтруктураКолонок.Вставить("bigint_field" , "bigint");
|
||||
СтруктураКолонок.Вставить("float24_field" , "float(24)");
|
||||
СтруктураКолонок.Вставить("float53_field" , "float(53)");
|
||||
СтруктураКолонок.Вставить("bit_field" , "bit");
|
||||
СтруктураКолонок.Вставить("nvarchar_field" , "nvarchar(4000)");
|
||||
СтруктураКолонок.Вставить("varbinary_field", "varbinary(max)");
|
||||
СтруктураКолонок.Вставить("uid_field" , "uniqueidentifier");
|
||||
СтруктураКолонок.Вставить("numeric_field" , "numeric(5,3)"); // Или decimal
|
||||
СтруктураКолонок.Вставить("xml_field" , "xml");
|
||||
СтруктураКолонок.Вставить("date_field" , "date");
|
||||
СтруктураКолонок.Вставить("time_field" , "time");
|
||||
СтруктураКолонок.Вставить("dto_field" , "datetimeoffset");
|
||||
СтруктураКолонок.Вставить("datetime_field" , "datetime");
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.СоздатьТаблицу(Таблица, СтруктураКолонок, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql СоздатьТаблицу \
|
||||
--table "somename" \
|
||||
--cols "{'tinyint_field':'tinyint','smallint_field':'smallint','int_field':'int','bigint_field':'bigint','float24_field':'float(24)','float53_field':'float(53)','bit_field':'bit','nvarchar_field':'nvarchar(4000)','varbinary_field':'varbinary(max)','uid_field':'uniqueidentifier','numeric_field':'numeric(5,3)','xml_field':'xml','date_field':'date','time_field':'time','dto_field':'datetimeoffset','datetime_field':'datetime','wtf_field':'WTF'}" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql СоздатьТаблицу ^
|
||||
--table "somename" ^
|
||||
--cols "{'tinyint_field':'tinyint','smallint_field':'smallint','int_field':'int','bigint_field':'bigint','float24_field':'float(24)','float53_field':'float(53)','bit_field':'bit','nvarchar_field':'nvarchar(4000)','varbinary_field':'varbinary(max)','uid_field':'uniqueidentifier','numeric_field':'numeric(5,3)','xml_field':'xml','date_field':'date','time_field':'time','dto_field':'datetimeoffset','datetime_field':'datetime','wtf_field':'WTF'}" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Удалить колонку таблицы и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Удалить колонку таблицы
|
||||
Удаляет колонку из таблицы
|
||||
|
||||
|
||||
|
||||
`Функция УдалитьКолонкуТаблицы(Знач Таблица, Знач Имя, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Имя | --name | Строка | ✔ | Имя колонки |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
|
||||
База = "testbase1";
|
||||
Таблица = "testtable";
|
||||
Имя = "new_field";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.УдалитьКолонкуТаблицы(Таблица, Имя, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьКолонкуТаблицы \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьКолонкуТаблицы ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Удалить таблицу и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Удалить таблицу
|
||||
Удаляет таблицу из базы
|
||||
|
||||
|
||||
|
||||
`Функция УдалитьТаблицу(Знач Таблица, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "testtable";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.УдалитьТаблицу(Таблица, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьТаблицу \
|
||||
--table "test_data" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql УдалитьТаблицу ^
|
||||
--table "test_data" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Гарантировать таблицу и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Гарантировать таблицу
|
||||
Создает новую таблицу в случае отсутствия или обновляет состав колонок существующей таблицы
|
||||
|
||||
|
||||
|
||||
`Функция ГарантироватьТаблицу(Знач Таблица, Знач СтруктураКолонок, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| СтруктураКолонок | --cols | Структура Из КлючИЗначение | ✔ | Структура колонок: Ключ > имя, Значение > Тип данных |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Существующее соединение или путь к базе |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
:::tip
|
||||
В результате изменения структуры таблицы данные могут быть утеряны! Рекомендуется предварительно опробовать данный метод на тестовых данных
|
||||
|
||||
Данная функция не обновляет тип данных существующих колонок
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
|
||||
База = "testbase1";
|
||||
Таблица = "testtable";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
СтруктураКолонок = Новый Структура;
|
||||
СтруктураКолонок.Вставить("smallint_field" , "smallint");
|
||||
СтруктураКолонок.Вставить("double_field" , "real");
|
||||
СтруктураКолонок.Вставить("bigint_field" , "bigint");
|
||||
СтруктураКолонок.Вставить("custom_field" , "nvarchar");
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.ГарантироватьТаблицу(Таблица, СтруктураКолонок, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ГарантироватьТаблицу \
|
||||
--table "test_new" \
|
||||
--cols "{'smallint_field':'smallint','double_field':'real','bigint_field':'bigint','custom_field':'nvarchar'}" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ГарантироватьТаблицу ^
|
||||
--table "test_new" ^
|
||||
--cols "{'smallint_field':'smallint','double_field':'real','bigint_field':'bigint','custom_field':'nvarchar'}" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true,
|
||||
"commit": {
|
||||
"result": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,191 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
description: Получить информацию о таблице и другие функции для работы с MSSQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MSSQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Получить информацию о таблице
|
||||
Получает информацию о таблице
|
||||
|
||||
|
||||
|
||||
`Функция ПолучитьИнформациюОТаблице(Знач Таблица, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MSSQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "SA";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
НастройкиTLS = OPI_MSSQL.ПолучитьНастройкиTLS(Истина);
|
||||
СтрокаПодключения = OPI_MSSQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль);
|
||||
|
||||
Таблица = "testtable";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MSSQL.ПолучитьИнформациюОТаблице(Таблица, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ПолучитьИнформациюОТаблице \
|
||||
--table "test_new" \
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mssql ПолучитьИнформациюОТаблице ^
|
||||
--table "test_new" ^
|
||||
--dbc "Server=127.0.0.1;Database=***;User Id=SA;Password=***;" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "tinyint_field",
|
||||
"data_type": "tinyint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "smallint_field",
|
||||
"data_type": "smallint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "int_field",
|
||||
"data_type": "int",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "bigint_field",
|
||||
"data_type": "bigint",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "float24_field",
|
||||
"data_type": "real",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "float53_field",
|
||||
"data_type": "float",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "bit_field",
|
||||
"data_type": "bit",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": 4000,
|
||||
"column_default": null,
|
||||
"column_name": "nvarchar_field",
|
||||
"data_type": "nvarchar",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": -1,
|
||||
"column_default": null,
|
||||
"column_name": "varbinary_field",
|
||||
"data_type": "varbinary",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "uid_field",
|
||||
"data_type": "uniqueidentifier",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "numeric_field",
|
||||
"data_type": "numeric",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": -1,
|
||||
"column_default": null,
|
||||
"column_name": "xml_field",
|
||||
"data_type": "xml",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "date_field",
|
||||
"data_type": "date",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "time_field",
|
||||
"data_type": "time",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "dto_field",
|
||||
"data_type": "datetimeoffset",
|
||||
"is_nullable": "YES"
|
||||
},
|
||||
{
|
||||
"character_maximum_length": null,
|
||||
"column_default": null,
|
||||
"column_name": "datetime_field",
|
||||
"data_type": "datetime",
|
||||
"is_nullable": "YES"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Работа с таблицами",
|
||||
"position": "4"
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Создать базу данных и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Создать базу данных
|
||||
Создает базу данных с указанным именем
|
||||
|
||||
|
||||
|
||||
`Функция СоздатьБазуДанных(Знач База, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| База | --base | Строка | ✔ | Имя базы |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
База = "testbase1";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MySQL.СоздатьБазуДанных(База, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql СоздатьБазуДанных \
|
||||
--base "testbase2" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql СоздатьБазуДанных ^
|
||||
--base "testbase2" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Удалить базу данных и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Удалить базу данных
|
||||
Удаляет базу данных
|
||||
|
||||
|
||||
|
||||
`Функция УдалитьБазуДанных(Знач База, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| База | --base | Строка | ✔ | Имя базы |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
База = "testbase1";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MySQL.УдалитьБазуДанных(База, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql УдалитьБазуДанных \
|
||||
--base "testbase2" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql УдалитьБазуДанных ^
|
||||
--base "testbase2" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'accept_invalid_certs':true,'ca_cert_path':'','use_tls':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Управление базами данных",
|
||||
"position": "3"
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
description: Добавить записи и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Добавить записи
|
||||
Добавляет записи в таблицу
|
||||
|
||||
|
||||
|
||||
`Функция ДобавитьЗаписи(Знач Таблица, Знач МассивДанных, Знач Транзакция = Истина, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| МассивДанных | --rows | Массив Из Структура | ✔ | Массив структур данных строк: Ключ > поле, Значение > значение поля |
|
||||
| Транзакция | --trn | Булево | ✖ | Истина > добавление записей в транзакции с откатом при ошибке |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
:::tip
|
||||
Данные записей указываются как массив структур вида:<br/>`{'Имя поля 1': {'Тип данных': 'Значение'}, 'Имя поля 2': {'Тип данных': 'Значение'},...}`
|
||||
|
||||
Список доступных типов описан на начальной странице документации библиотеки MySQL
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
Таблица = "testtable";
|
||||
МассивЗаписей = Новый Массив;
|
||||
|
||||
Картинка = "https://hut.openintegrations.dev/test_data/picture.jpg";
|
||||
OPI_ПреобразованиеТипов.ПолучитьДвоичныеДанные(Картинка); // Картинка - Тип: ДвоичныеДанные
|
||||
|
||||
ТекущаяДата = OPI_Инструменты.ПолучитьТекущуюДату();
|
||||
|
||||
СтруктураЗаписи = Новый Структура;
|
||||
СтруктураЗаписи.Вставить("char_field" , Новый Структура("TEXT" , "AAAAA"));
|
||||
СтруктураЗаписи.Вставить("varchar_field" , Новый Структура("TEXT" , "Some varchar"));
|
||||
СтруктураЗаписи.Вставить("tinytext_field" , Новый Структура("TEXT" , "Some tiny text"));
|
||||
СтруктураЗаписи.Вставить("text_field" , Новый Структура("TEXT" , "Some text"));
|
||||
СтруктураЗаписи.Вставить("mediumtext_field", Новый Структура("TEXT" , "Some medium text"));
|
||||
СтруктураЗаписи.Вставить("longtext_field" , Новый Структура("TEXT" , "Some looooooong text"));
|
||||
СтруктураЗаписи.Вставить("tinyint_field" , Новый Структура("INT" , 127));
|
||||
СтруктураЗаписи.Вставить("smallint_field" , Новый Структура("INT" , -32767));
|
||||
СтруктураЗаписи.Вставить("mediumint_field" , Новый Структура("INT" , 8388607));
|
||||
СтруктураЗаписи.Вставить("int_field" , Новый Структура("INT" , -2147483647));
|
||||
СтруктураЗаписи.Вставить("uint_field" , Новый Структура("UINT" , 4294967295));
|
||||
СтруктураЗаписи.Вставить("bigint_field" , Новый Структура("INT" , 9223372036854775807));
|
||||
СтруктураЗаписи.Вставить("float_field" , Новый Структура("FLOAT" , 100.50));
|
||||
СтруктураЗаписи.Вставить("double_field" , Новый Структура("FLOAT" , 100.512123));
|
||||
СтруктураЗаписи.Вставить("date_field" , Новый Структура("DATE" , ТекущаяДата));
|
||||
СтруктураЗаписи.Вставить("time_field" , Новый Структура("TIME" , ТекущаяДата));
|
||||
СтруктураЗаписи.Вставить("datetime_field" , Новый Структура("DATE" , ТекущаяДата));
|
||||
СтруктураЗаписи.Вставить("timestamp_field" , Новый Структура("DATE" , ТекущаяДата));
|
||||
СтруктураЗаписи.Вставить("mediumblob_field", Новый Структура("BYTES" , Картинка));
|
||||
СтруктураЗаписи.Вставить("set_field" , Новый Структура("TEXT" , "one"));
|
||||
|
||||
МассивЗаписей.Добавить(СтруктураЗаписи);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MySQL.ДобавитьЗаписи(Таблица, МассивЗаписей, Истина, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ДобавитьЗаписи \
|
||||
--table "testtable" \
|
||||
--rows "[{'char_field':{'TEXT':'AAAAA'},'varchar_field':{'TEXT':'Some varchar'},'tinytext_field':{'TEXT':'Some tiny text'},'text_field':{'TEXT':'Some text'},'mediumtext_field':{'TEXT':'Some medium text'},'longtext_field':{'TEXT':'Some looooooong text'},'tinyint_field':{'INT':'127'},'smallint_field':{'INT':'-32767'},'mediumint_field':{'INT':'8388607'},'int_field':{'INT':'-2147483647'},'uint_field':{'UINT':'4294967295'},'bigint_field':{'INT':'9223372036854775807'},'float_field':{'FLOAT':'100.5'},'double_field':{'FLOAT':'100.512123'},'date_field':{'DATE':'2/20/2026 1:05:14 AM'},'time_field':{'TIME':'2/20/2026 1:05:14 AM'},'datetime_field':{'DATE':'2/20/2026 1:05:14 AM'},'timestamp_field':{'DATE':'2/20/2026 1:05:14 AM'},'mediumblob_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\xyroafpu.pxt'},'set_field':{'TEXT':'one'}}]" \
|
||||
--trn true \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ДобавитьЗаписи ^
|
||||
--table "testtable" ^
|
||||
--rows "[{'char_field':{'TEXT':'AAAAA'},'varchar_field':{'TEXT':'Some varchar'},'tinytext_field':{'TEXT':'Some tiny text'},'text_field':{'TEXT':'Some text'},'mediumtext_field':{'TEXT':'Some medium text'},'longtext_field':{'TEXT':'Some looooooong text'},'tinyint_field':{'INT':'127'},'smallint_field':{'INT':'-32767'},'mediumint_field':{'INT':'8388607'},'int_field':{'INT':'-2147483647'},'uint_field':{'UINT':'4294967295'},'bigint_field':{'INT':'9223372036854775807'},'float_field':{'FLOAT':'100.5'},'double_field':{'FLOAT':'100.512123'},'date_field':{'DATE':'2/20/2026 1:05:14 AM'},'time_field':{'TIME':'2/20/2026 1:05:14 AM'},'datetime_field':{'DATE':'2/20/2026 1:05:14 AM'},'timestamp_field':{'DATE':'2/20/2026 1:05:14 AM'},'mediumblob_field':{'BYTES':'C:\\Users\\bayse\\AppData\\Local\\Temp\\xyroafpu.pxt'},'set_field':{'TEXT':'one'}}]" ^
|
||||
--trn true ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"commit": {
|
||||
"result": true
|
||||
},
|
||||
"result": true,
|
||||
"rows": 1,
|
||||
"errors": []
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
description: Удалить записи и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Удалить записи
|
||||
Удаляет записи из таблицы
|
||||
|
||||
|
||||
|
||||
`Функция УдалитьЗаписи(Знач Таблица, Знач Фильтры = "", Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Фильтры | --filter | Массив Из Структура | ✖ | Массив фильтров. См. [`ПолучитьСтруктуруФильтраЗаписей`](/docs/MySQL/Record-management/Get-records-filter-structure) |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "test_data";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
Таблица = "test_data";
|
||||
|
||||
Фильтры = Новый Массив;
|
||||
|
||||
СтруктураФильтра = Новый Структура;
|
||||
|
||||
СтруктураФильтра.Вставить("field", "gender");
|
||||
СтруктураФильтра.Вставить("type" , "=");
|
||||
СтруктураФильтра.Вставить("value", Новый Структура("VARCHAR", "Male"));
|
||||
СтруктураФильтра.Вставить("raw" , Ложь);
|
||||
СтруктураФильтра.Вставить("union", "AND");
|
||||
|
||||
Фильтры.Добавить(СтруктураФильтра);
|
||||
|
||||
СтруктураФильтра = Новый Структура;
|
||||
|
||||
СтруктураФильтра.Вставить("field", "ip_address");
|
||||
СтруктураФильтра.Вставить("type" , "=");
|
||||
СтруктураФильтра.Вставить("value", Новый Структура("VARCHAR", "127.0.0.1"));
|
||||
СтруктураФильтра.Вставить("raw" , Ложь);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MySQL.УдалитьЗаписи(Таблица, Фильтры, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql УдалитьЗаписи \
|
||||
--table "test_data" \
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false,'union':'AND'}]" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql УдалитьЗаписи ^
|
||||
--table "test_data" ^
|
||||
--filter "[{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false,'union':'AND'}]" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,104 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
description: Гарантировать записи и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Гарантировать записи
|
||||
Добавляет записи или обновляет данные существующих при совпадении ключевых полей
|
||||
|
||||
|
||||
|
||||
`Функция ГарантироватьЗаписи(Знач Таблица, Знач МассивДанных, Знач Транзакция = Истина, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| МассивДанных | --rows | Массив Из Структура | ✔ | Массив структур данных строк: Ключ > поле, Значение > значение поля |
|
||||
| Транзакция | --trn | Булево | ✖ | Истина > добавление записей в транзакции с откатом при ошибке |
|
||||
| Соединение | --db | Строка, Произвольный | ✖ | Существующее соединение или путь к базе |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
:::tip
|
||||
В качестве ключевых выступают все UNIQUE и PRIMARY KEY поля таблицы
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
Таблица = "test_merge";
|
||||
|
||||
МассивДанных = Новый Массив;
|
||||
|
||||
СтруктураСтроки1 = Новый Структура;
|
||||
СтруктураСтроки1.Вставить("id" , Новый Структура("INT" , 1));
|
||||
СтруктураСтроки1.Вставить("name" , Новый Структура("TEXT" , "Vitaly"));
|
||||
СтруктураСтроки1.Вставить("age" , Новый Структура("INT" , 25));
|
||||
СтруктураСтроки1.Вставить("salary", Новый Структура("DOUBLE", 1000.12));
|
||||
|
||||
СтруктураСтроки2 = Новый Структура;
|
||||
СтруктураСтроки2.Вставить("id" , Новый Структура("INT" , 2));
|
||||
СтруктураСтроки2.Вставить("name" , Новый Структура("TEXT" , "Lesha"));
|
||||
СтруктураСтроки2.Вставить("age" , Новый Структура("INT" , 20));
|
||||
СтруктураСтроки2.Вставить("salary", Новый Структура("DOUBLE", 200.20));
|
||||
|
||||
МассивДанных.Добавить(СтруктураСтроки1);
|
||||
МассивДанных.Добавить(СтруктураСтроки2);
|
||||
|
||||
КлючевыеПоля = Новый Массив;
|
||||
КлючевыеПоля.Добавить("id");
|
||||
|
||||
Результат = OPI_MySQL.ГарантироватьЗаписи(Таблица, МассивДанных, , СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ГарантироватьЗаписи \
|
||||
--table "test_merge" \
|
||||
--rows "[{'id':{'INT':'1'},'name':{'TEXT':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DOUBLE':'1500.5'}},{'id':{'INT':'3'},'name':{'TEXT':'Anton'},'age':{'INT':'30'},'salary':{'DOUBLE':'3000'}}]" \
|
||||
--db "mysql://bayselonarrend:12we3456!2154@127.0.0.1:3307/testbase1" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ГарантироватьЗаписи ^
|
||||
--table "test_merge" ^
|
||||
--rows "[{'id':{'INT':'1'},'name':{'TEXT':'Vitaly Updated'},'age':{'INT':'25'},'salary':{'DOUBLE':'1500.5'}},{'id':{'INT':'3'},'name':{'TEXT':'Anton'},'age':{'INT':'30'},'salary':{'DOUBLE':'3000'}}]" ^
|
||||
--db "mysql://bayselonarrend:12we3456!2154@127.0.0.1:3307/testbase1" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
description: Получить структуру фильтра записей и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Получить структуру фильтра записей
|
||||
Получает структуру шаблон для фильтрации записей в запросах ORM
|
||||
|
||||
|
||||
|
||||
`Функция ПолучитьСтруктуруФильтраЗаписей(Знач Пустая = Ложь) Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Пустая | --empty | Булево | ✖ | Истина > структура с пустыми значениями, Ложь > в значениях будут описания полей |
|
||||
|
||||
|
||||
Возвращаемое значение: Структура Из КлючИЗначение - Элемент фильтра записей
|
||||
|
||||
:::tip
|
||||
Использование признака `raw` необходимо для составных конструкций, вроде `BETWEEN`. Например: при `raw:false` фильтр `type:BETWEEN` `value:10 AND 20` будет интерпретирован как `BETWEEN ?1 ` где `?1 = "10 AND 20"`, что приведет к ошибке. В таком случае необходимо использовать `raw:true` для установки условия напрямую в текст запроса
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Результат = OPI_MySQL.ПолучитьСтруктуруФильтраЗаписей();
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
oint mysql ПолучитьСтруктуруФильтраЗаписей \
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
oint mysql ПолучитьСтруктуруФильтраЗаписей ^
|
||||
--empty true
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"field": "<имя поля для отбора>",
|
||||
"type": "<тип сравнения>",
|
||||
"value": "<значение для сравнения>",
|
||||
"union": "<связь со следующим условием: AND, OR и пр.>",
|
||||
"raw": "<истина - значение будет вставлено текстом, как есть, ложь - через параметр>"
|
||||
}
|
||||
```
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
description: Получить записи и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Получить записи
|
||||
Получает записи из выбранной таблицы
|
||||
|
||||
|
||||
|
||||
`Функция ПолучитьЗаписи(Знач Таблица, Знач Поля = "*", Знач Фильтры = "", Знач Сортировка = "", Знач Количество = "", Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Поля | --fields | Массив Из Строка | ✖ | Поля для выборки |
|
||||
| Фильтры | --filter | Массив Из Структура | ✖ | Массив фильтров. См. [`ПолучитьСтруктуруФильтраЗаписей`](/docs/MySQL/Record-management/Get-records-filter-structure) |
|
||||
| Сортировка | --order | Структура Из КлючИЗначение | ✖ | Сортировка: Ключ > поле, Значение > направление (ASC, DESC) |
|
||||
| Количество | --limit | Число | ✖ | Ограничение количества получаемых строк |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
// Все записи без отборов
|
||||
|
||||
Таблица = "testtable";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MySQL.ПолучитьЗаписи(Таблица, , , , , СтрокаПодключения, НастройкиTLS);
|
||||
|
||||
// Отборы, выбранные поля, количество и сортировка
|
||||
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, "test_data", Логин, Пароль, Порт);
|
||||
|
||||
Таблица = "test_data";
|
||||
|
||||
Поля = Новый Массив;
|
||||
Поля.Добавить("first_name");
|
||||
Поля.Добавить("last_name");
|
||||
Поля.Добавить("email");
|
||||
|
||||
Фильтры = Новый Массив;
|
||||
|
||||
СтруктураФильтра1 = Новый Структура;
|
||||
|
||||
СтруктураФильтра1.Вставить("field", "gender");
|
||||
СтруктураФильтра1.Вставить("type" , "=");
|
||||
СтруктураФильтра1.Вставить("value", "Male");
|
||||
СтруктураФильтра1.Вставить("union", "AND");
|
||||
СтруктураФильтра1.Вставить("raw" , Ложь);
|
||||
|
||||
СтруктураФильтра2 = Новый Структура;
|
||||
|
||||
СтруктураФильтра2.Вставить("field", "id");
|
||||
СтруктураФильтра2.Вставить("type" , "BETWEEN");
|
||||
СтруктураФильтра2.Вставить("value", "20 AND 50");
|
||||
СтруктураФильтра2.Вставить("raw" , Истина);
|
||||
|
||||
Фильтры.Добавить(СтруктураФильтра1);
|
||||
Фильтры.Добавить(СтруктураФильтра2);
|
||||
|
||||
Сортировка = Новый Структура("ip_address", "DESC");
|
||||
Количество = 5;
|
||||
|
||||
Результат = OPI_MySQL.ПолучитьЗаписи(Таблица, Поля, Фильтры, Сортировка, Количество, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ПолучитьЗаписи \
|
||||
--table "testtable" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ПолучитьЗаписи ^
|
||||
--table "testtable" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"bigint_field": 9223372036854775807,
|
||||
"char_field": "AAAAA",
|
||||
"date_field": "2026-02-20T00:00:00+00:00",
|
||||
"datetime_field": "2026-02-20T11:45:08+00:00",
|
||||
"double_field": 100.51212310791,
|
||||
"float_field": 100.5,
|
||||
"int_field": -2147483647,
|
||||
"longtext_field": "Some looooooong text",
|
||||
"mediumblob_field": {
|
||||
"BYTES": "/9j/4VTBRX..."
|
||||
},
|
||||
"mediumint_field": 8388607,
|
||||
"mediumtext_field": "Some medium text",
|
||||
"set_field": "one",
|
||||
"smallint_field": -32767,
|
||||
"text_field": "Some text",
|
||||
"time_field": "1970-01-01T11:45:08+00:00",
|
||||
"timestamp_field": "2026-02-20T11:45:08+00:00",
|
||||
"tinyint_field": 127,
|
||||
"tinytext_field": "Some tiny text",
|
||||
"uint_field": 4294967295,
|
||||
"varchar_field": "Some varchar"
|
||||
}
|
||||
],
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Обновить записи и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Обновить записи
|
||||
Обновляет значение записей по выбранным критериям
|
||||
|
||||
|
||||
|
||||
`Функция ОбновитьЗаписи(Знач Таблица, Знач СтруктураЗначений, Знач Фильтры = "", Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| СтруктураЗначений | --values | Структура Из КлючИЗначение | ✔ | Структура значений: Ключ > поле, Значение > значение поля |
|
||||
| Фильтры | --filter | Массив Из Структура | ✖ | Массив фильтров. См. [`ПолучитьСтруктуруФильтраЗаписей`](/docs/MySQL/Record-management/Get-records-filter-structure) |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
:::tip
|
||||
Данные записей указываются как массив структур вида:<br/>`{'Имя поля 1': {'Тип данных': 'Значение'}, 'Имя поля 2': {'Тип данных': 'Значение'},...}`
|
||||
|
||||
Список доступных типов описан на начальной странице документации библиотеки MySQL
|
||||
:::
|
||||
<br/>
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "test_data";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
Таблица = "test_data";
|
||||
|
||||
СтруктураПолей = Новый Структура;
|
||||
СтруктураПолей.Вставить("ip_address", Новый Структура("VARCHAR", "127.0.0.1"));
|
||||
|
||||
Фильтры = Новый Массив;
|
||||
|
||||
СтруктураФильтра = Новый Структура;
|
||||
|
||||
СтруктураФильтра.Вставить("field", "gender");
|
||||
СтруктураФильтра.Вставить("type" , "=");
|
||||
СтруктураФильтра.Вставить("value", Новый Структура("VARCHAR", "Male"));
|
||||
СтруктураФильтра.Вставить("raw" , Ложь);
|
||||
|
||||
Фильтры.Добавить(СтруктураФильтра);
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MySQL.ОбновитьЗаписи(Таблица, СтруктураПолей, СтруктураФильтра, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ОбновитьЗаписи \
|
||||
--table "test_data" \
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" \
|
||||
--filter "{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false}" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ОбновитьЗаписи ^
|
||||
--table "test_data" ^
|
||||
--values "{'ip_address':{'VARCHAR':'127.0.0.1'}}" ^
|
||||
--filter "{'field':'gender','type':'=','value':{'VARCHAR':'Male'},'raw':false}" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Работа с записями",
|
||||
"position": "5"
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
description: Добавить колонку таблицы и другие функции для работы с MySQL в Открытом пакете интеграций - бесплатной open-source библиотеке интеграций для 1С:Предприятие 8, OneScript и CLI
|
||||
keywords: [1C, 1С, 1С:Предприятие, 1С:Предприятие 8.3, API, Интеграция, Сервисы, Обмен, OneScript, CLI, MySQL]
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Добавить колонку таблицы
|
||||
Добавляет новую колонку в существующую таблицу
|
||||
|
||||
|
||||
|
||||
`Функция ДобавитьКолонкуТаблицы(Знач Таблица, Знач Имя, Знач ТипДанных, Знач Соединение = "", Знач Tls = "") Экспорт`
|
||||
|
||||
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|
||||
|-|-|-|-|-|
|
||||
| Таблица | --table | Строка | ✔ | Имя таблицы |
|
||||
| Имя | --name | Строка | ✔ | Имя колонки |
|
||||
| ТипДанных | --type | Строка | ✔ | Тип данных колонки |
|
||||
| Соединение | --dbc | Строка, Произвольный | ✖ | Соединение или строка подключения |
|
||||
| Tls | --tls | Структура Из КлючИЗначение | ✖ | Настройки TLS, если необходимо. См. [`ПолучитьНастройкиTls`](/docs/MySQL/Common-methods/Get-tls-settings) |
|
||||
|
||||
|
||||
Возвращаемое значение: Соответствие Из КлючИЗначение - Результат выполнения запроса
|
||||
|
||||
|
||||
|
||||
```bsl title="Пример использования для 1С:Предприятие/OneScript"
|
||||
Адрес = "127.0.0.1";
|
||||
Логин = "bayselonarrend";
|
||||
Пароль = "12we...";
|
||||
База = "testbase1";
|
||||
|
||||
TLS = Истина;
|
||||
Порт = 3306;
|
||||
СтрокаПодключения = OPI_MySQL.СформироватьСтрокуПодключения(Адрес, База, Логин, Пароль, Порт);
|
||||
|
||||
Если TLS Тогда
|
||||
НастройкиTLS = OPI_MySQL.ПолучитьНастройкиTLS(Истина);
|
||||
Иначе
|
||||
НастройкиTLS = Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
Таблица = "testtable";
|
||||
Имя = "new_field";
|
||||
ТипДанных = "MEDIUMTEXT";
|
||||
|
||||
// При использовании строки подключения инициализируется новое соединение,
|
||||
// которое будет закрыто после выполнения функции.
|
||||
// В случае выполнения нескольких операций желательно использовать одно соединение,
|
||||
// заранее созданное функцией ОткрытьСоединение()
|
||||
Результат = OPI_MySQL.ДобавитьКолонкуТаблицы(Таблица, Имя, ТипДанных, СтрокаПодключения, НастройкиTLS);
|
||||
```
|
||||
|
||||
|
||||
<Tabs>
|
||||
|
||||
<TabItem value="bash" label="Bash" default>
|
||||
```bash
|
||||
# JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ДобавитьКолонкуТаблицы \
|
||||
--table "testtable" \
|
||||
--name "new_field" \
|
||||
--type "MEDIUMTEXT" \
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" \
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bat" label="CMD/Bat" default>
|
||||
```batch
|
||||
:: JSON данные также могут быть переданы как путь к файлу .json
|
||||
|
||||
oint mysql ДобавитьКолонкуТаблицы ^
|
||||
--table "testtable" ^
|
||||
--name "new_field" ^
|
||||
--type "MEDIUMTEXT" ^
|
||||
--dbc "mysql://bayselonarrend:***@127.0.0.1:3306/" ^
|
||||
--tls "{'use_tls':true,'accept_invalid_certs':true}"
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
```json title="Результат"
|
||||
{
|
||||
"result": true
|
||||
}
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user