Creating A Db Map Variable; Db Map Variables And Db Mapping - Omron NX701-1620 User Manual

Machine automation controller nj/nx-series database connection cpu units
Hide thumbs Also See for NX701-1620:
Table of Contents

Advertisement

3-3 Creating a DB Map Variable

After creating a user-defined structure data type for DB access, you create a variable using the
data type. The variable is called "DB Map Variable".
This section describes the specifications and creation procedure of DB Map Variables.
3-3-1

DB Map Variables and DB Mapping

Each DB Map Variable uses a structure data type for DB access as its data type.
You create a mapping* for a DB Map Variable to the connected DB for each SQL type (i.e.,
INSERT, UPDATE, and SELECT) by executing a DB_CreateMapping (Create DB Map)
instruction.
After creating the DB mapping, you can execute each record processing for inserting, updating,
and retrieving records using the DB Map Variable by executing a DB_Insert (Insert DB Record),
DB_Update (Update DB Record), or DB_Select (Retrieve DB Record) instruction.
Structure data type for
DB access
* The DB mapping means to assign each member of a DB Map Variable to the corresponding column of
a table in the connected DB. You need to execute the DB mapping for each record processing for
inserting, updating, and retrieving records.
You can map more than one DB Map Variable for a DB Connection.
The following table shows the operation of each record processing (i.e., INSERT, UPDATE, and
SELECT) to be performed when you create a structure where not all, but some of the columns
are specified as members.
Record processing
Inserting records (INSERT)
Updating records (UPDATE)
Retrieving records (SELECT)
Precautions for Correct Use
If you retrieve a record that includes a column of NULL value when executing a DB_Select
(Retrieve DB Record) instruction, the instruction will result in an instruction error (SQL
Execution Error).
NJ/NX-series Database Connection CPU Units User's Manual (W527)
3 Programming the DB Connection Function
DB mapping
DB Map Variable
Var_Insert
Use
DB Map Variable
Var_Update
DB Map Variable
Var_Select
By executing a DB_CreateMapping (Create DB Map) instruction
The record values are written to the specified columns of the DB.
NULL is entered in the unspecified columns. You need to make a setting for allowing
NULL in the DB.
Values are updated only in the specified columns.
Values are not changed in the unspecified columns.
Values are retrieved only from the specified columns.
You need to specify only the columns that do not contain NULL.
SQL type
Var_Insert can be used in DB_Insert (Insert
INSERT
DB Record) instructions.
Var_Update can be used in
UPDATE
DB_Update (Update DB Record) instructions.
Var_Select can be used in
SELECT
DB_Select (Retrieve DB Record) instructions.
Operation
3
3-15

Advertisement

Table of Contents

Troubleshooting

loading

Table of Contents