Database Access Instruction; Usage Procedure - Mitsubishi Electric MELSEC iQ-R-R00CPU User Manual

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

Advertisement

13.2

Database Access Instruction

Usage procedure

This section describes the procedure to use the database function.
Creating databases
To construct a database on an SD memory card, create a Unicode text file which defines the configuration of the database
and its tables, store the file on the SD memory card, and execute the DBIMPORT(P) instruction, specifying the created
Unicode text file.
1.
Create a Unicode text file which defines the configuration of a database and its tables. ( Page 237 Creating Unicode
text files)
2.
Write the created Unicode text file to the SD memory card. For details on how to write Unicode text files (write of user
data), refer to the following.
 GX Works3 Operating Manual
3.
By executing the DBIMPORT(P) instruction with the created Unicode text file specified, the database folder is created on
the same layer as the Unicode text file and the database is constructed. ( Page 240 Folder configuration of
databases)
The DBEXPORT(P) instruction enables the user to check the contents of a database by exporting it to a
Unicode text file. Also, when the user wants to add more than one record or field to a database, the user can
change the configuration of the database by exporting it to a Unicode text file, editing the file, and executing
the DBIMPORT(P) instruction to get the database back to the system.
Operating databases
First, the user must execute the DBOPEN(P) instruction to connect to the database which the user wants to work on. Also,
after finishing database operation, the user must execute the DBCLOSE(P) instruction to disconnect from the database.
1.
Execute the DBOPEN(P) instruction to connect to the database which the user wants to work on (connect to the
database by specifying the folder which was created in Step 3 of the database creation procedure). When the execution
is finished, a value including the "database ID number" is returned.
Database ID numbers are necessary to perform database operation. Therefore, please make a note of the
database ID number of each database.
2.
Once the connection to the database is established, perform operation (addition, update, search, or deletion) of the
database. To perform database operation, the user must specify the "database ID number" of the target database in each
instruction.
3.
When database operation is finished, execute the DBCLOSE(P) instruction to disconnect from the database.
The user can use a transaction when the user wants to perform multiple operations for a database as a set
and update the database at once. ( Page 240 Transactions for databases)
13 DATABASE FUNCTION
236
13.2 Database Access Instruction

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents