Transactions For Databases; Folder Configuration Of Databases - Mitsubishi Electric MELSEC iQ-R-R00CPU User Manual

Melsec iq-r series cpu module application user's manual
Table of Contents

Advertisement

Transactions for databases

Use a transaction (the DBTRANS(P) instruction and the DBCOMMIT(P) instruction) to perform multiple operations for a
database as a set and update the database at once. The DBTRANS(P) instruction starts a transaction, and the
DBCOMMIT(P) instruction groups the results of the following instructions together to update the target database at once.
• The target of a transaction must be a single database. If a transaction is executed for more than one database, transaction
instructions for the second and later databases are completed with errors.
• When the CPU module is powered off or is reset in the period from the start of a transaction (execution of the DBTRANS(P)
instruction) to the commit of the transaction (execution of the DBCOMMIT(P) instruction), the database is automatically
rolled back to the status before the start of the transaction. However, if a database access instruction is completed with an
error, the database is not roll backed to the previous status.
• To cancel the running transaction processing and reset the database to the status before the start of the transaction,
perform a rollback (the DBROLBAK(P) instruction). A rollback is an operation which resets the target database to the
previous status by executing the DBROLBAK(P) instruction in the period from the start of the transaction to the commit of
the transaction. When the DBCLOSE(P) instruction is executed without the DBCOMMIT(P) instruction or the
DBROLBAK(P) instruction, the transaction is committed during execution of the DBCLOSE(P) instruction.
1.
Execute the DBOPEN(P) instruction to connect to a database.
2.
Execute the DBTRANS(P) instruction to start a transaction.
3.
Operate the database.
4.
To commit the transaction, execute the DBCOMMIT(P) instruction. When committing the transaction is not necessary,
execute the DBROLBAK(P) instruction to restore to the state before the start of the transaction (rollback).
5.
Execute the DBCLOSE(P) instruction to disconnect from the database.

Folder configuration of databases

The database folder for storing database files is generated at the same level in the folder hierarchy as the Unicode text file
which is specified in the DBIMPORT(P) instruction. Also, the database folder is given the same names as the database. The
length of a database folder path name must be up to 128 characters, including the drive name and a colon (:) prefixed to the
path name.
Root directory
DATABASE
Operation of files/folders in the database folder
Files and folders in the database folder are used for database access instructions. They should not be changed, deleted, and
newly created. Otherwise, database access instructions may be completed with errors. In that case, delete the relevant
database folder.
13 DATABASE FUNCTION
240
13.2 Database Access Instruction
Unicode text file defining database
Database name: DB_ABC
ABC.txt
Database
file
DB_ABC
Database
file
Database
file
If the Unicode text file "ABC.txt" is
specified using the DBIMPORT
instruction, the DB_ABC folder is
created at the same level, and
the database file of the database
"DB_ABC" is created in
the DB_ABC folder.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents