Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Insert record Version 11 (Java)

Группа действий: Базы данных

Описание действия

Добавляет запись (строку) в указанную таблицу БД. 

Иконка действия

Image Removed

Параметры

Входные параметры

  1. Контекст БД Контекст подключения к выбранной базе данных.

  2. Имя таблицы Имя таблицы в БД.

  3. Данные для вставки – Словарь данных для вставки в таблицу.

  4. Список имен полей первичного ключа – Список имен полей первичного ключа, который будет получен в результате.

Выходные параметры

В результате получаем Список значений первичного ключа, сгенерированных в результате вставки данных для полей.

Настройки

...

Свойство

...

Описание

...

Тип

...

Пример заполнения

...

Обязательность заполнения поля

...

Параметры

...

Контекст БД

...

Контекст подключения к выбранной базе данных

...

Robin.DbContext

...

Контекст баз данных

...

Да

...

Имя таблицы

...

Имя таблицы

...

Robin.String

...

Да

...

Данные для вставки

...

Данные в виде словаря для вставки в таблицу

...

Robin.Dictionary

...

Да

...

Список имен полей первичного ключа

...

Список имен полей первичного ключа, который нужно получить в результате

...

Robin.Collection

...

Нет

...

Список значений первичного ключа

...

Список значений первичного ключа, сгенерированных в результате вставки данных для полей, указанных в параметре «Список имен полей первичного ключа»

...

Robin.Dictionary

Action group: Databases

...

Description

The action adds the text (string) in the given DB table. 

Action icon

Image Added

Parameters

Input parameters 

  1. DB context – connection context to the selected database.

  2. Table name – table name in DB.

  3. Insert data – data in the form of a dictionary for insertion into a table.

  4. List of primary key field names – list of primary key field names to be returned.

Output parameters

As a result we get the list of primary key values generated when inserting data for the field. 

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
DB contextConnection context to the selected databaseRobin.DbContextDatabase contextYes
Table nameTable nameRobin.String
Yes
Insert dataData in the form of a dictionary for insertion into a tableRobin.Dictionary
Yes
List of primary key field namesList of primary key field names to be returnedRobin.Collection
No
Results
List of primary key valuesList of primary key values generated as a result of inserting data for the fields specified in the «List of primary key field names» parameterRobin.Dictionary

Special conditions of use 

None.

Example of use

Task

Connect to the database and add data to the table (company_name and inn columns). Data: ООО "Ромашка", 5047053423

Image Added

Solution

Use the "Connect Standard Db", "InsertRecord" actions. 

Implementation

  1. Assemble a robot scheme consisting of actions
    Image Added
  2. Set the parameters for the "Connect Standard Db" action. 
    In the "DATABASE TYPE" field, select the appropriate database to which you want to connect. 
    Specify the database login and password. 
    The server host can be specified either by the IP of the host where the database is installed or by the host name. 
    Specify the server port, as well as the database name. 
    In the "Timeout" field, the value is calculated in seconds. 
    In the "Parameters" field specify additional parameters for connection, usually these are parameters that relate to security. Parameters are specified in the form of a dictionary. 

    Read more about the "Transaction isolation level" parameter. The sequential database operations can be divided into transactions. A transaction is a group of operations that represent a certain boolean unit of working with the database. For example, it is necessary to perform several operations with a table in order to update the data in it. If an error occurs, you can roll back the transaction, i.e. a group of operations made, so that you do not have to figure out at what step this error occurred. 

    If the checkbox "Transaction isolation level" is activated, part of the performed queries to the database will be in the form of transactions. 


    image2024-2-12_11-23-8.pngImage Added
  3. Set the parameters for the "Insert record" action. 
    In the "Insert data" field specify data in the form of a dictionary. Image AddedImage Added
    In the "List of primary key field names" field fill in the following manner:  
    Image Added
  4. Click the "Start" button in the top panel. 

Result

The program robot completed successfully. New text inserted in the table. 

Image Added

Image Added

Особые условия использования

Отсутствуют.

Пример использования 

Задача

Подключиться к базе данных и добавить данные в таблицу (столбцы AGENT_NAME, WORKING_AREA, COMMISSION, PHONE_NO и COUNTRY) . Данные: Lucida, Mumbai, 0.13, 077-12346674, USA.

image2024-2-12_11-24-57.pngImage Removed

Решение

Воспользоваться действиями "Connect Standard Db", "InsertRecord". 

Реализация

  1. Собрать робота, состоящего из действий:
    Image Removed
  2. Настроить параметры для действия "Стандартное подключение". 
    image2024-2-12_11-23-8.pngImage Removed
  3. Настроить параметры для действия "Добавить запись". 
    Image Removed
    В поле "Данные для вставки" указать данные в виде словаря. 
    Image Removed
    В поле "Список имен полей первичного ключа" заполнить следующим образом: 
    Image Removed
  4. Нажать на кнопку "Старт" в верхней панели. 

Результат

Программный робот отработал успешно.

Image Removed

Новая запись добавлена в таблицу. 

Image Removed