История страницы
Обновить запись Версия Update Record Version 9 (Java)
Группа действий: Базы данных
Описание действия
Действие обновляет данные в записи указанной таблицы БД по значению ее первичного ключа.
Иконка действия
Параметры
Входные параметры
Контекст БД – Контекст подключения к выбранной базе данных.
Имя таблицы – Имя таблицы в БД.
Данные для обновления записи – Словарь данных записей, которые будут обновлены.
Первичный ключ – Словарь полей, с помощью которых однозначно определяют запись, которую необходимо обновить.
Настройки
Action group: Databases
...
Description
The action updates the data in the specified database table record by the value of its primary key
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
DB context | The connection context for the selected database |
Свойство
Описание
Тип
Пример заполнения
Обязательность заполнения поля
Параметры
Контекст БД
. | Robin.DbContext |
Контекст баз данных
Да
Имя таблицы
Database context | Yes | |
Table name | Table name | Robin.String |
Да
Данные для обновления записи
Yes | ||
Data to update the record | Data to update as a dictionary, where keys are column names | Robin.Dictionary |
Да
Первичный ключ
Yes | ||
PRIME KEY DATA | A field or combination of fields that uniquely identifies the record to be updated. Specified as a dictionary, where key-value pairs are the names of the primary key columns and the contents of their fields. | Robin.Dictionary |
Да
Особые условия использования
Отсутствуют.
Пример использования
Задача
Подключиться к базе данных и обновить данные по одной строке таблицы по столбцам company_name и inn (id=9). Обновить на данные: ООО "Ромашка", 5013047634
Решение
Воспользоваться действиями "Стандартное подключение", "Обновить запись".
Реализация
...
Yes |
Special conditions of use
None.
Example of use
Task
Connect to the database and update the data one row at a time in the table for the columns AGENT_NAME, WORKING_AREA, COMMISSION, PHONE_NO and COUNTRY (ID=5). Update to data: McDen, London, 0.15, 044-52981425, UK.
Solution
Use the actions "Connect Standard Db", "UpdateRecord".
Implementation
- Assemble a robot scheme consisting of actions:
- Fill in 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.
Learn more about the "Transaction isolation level" parameter. Sequential database operations can be divided into transactions. A transaction is a group of operations that represent a certain boolean unit of work 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 don't have to figure out at which step this error occurred.
If the "Transaction isolation level" checkbox is activated, a part of the executed queries to the database will be in the form of transactions. - Configure the settings for the "Update Record" action.
In the "Data to update record" field, specify new data in the form of a dictionary.
In the "Primary Key" field, specify the value of the primary key as a dictionary. - Click on the "Start" button in the top panel.
Result
The program robot completed successfully.
The data in the database has been updated.
...
- 3. Настроить параметры для действия "Обновить запись".
В поле "Данные для обновления записи" указать новые данные в виде словаря.
В поле "Первичный ключ" указать значение первичного ключа в виде словаря.
4. Нажать на кнопку "Старт" в верхней панели.
Результат
Программный робот отработал успешно. Данные в базе обновлены.