The [ODBC]section in RTES32.CNF defines:
Example:
R0123 LOG 1.00 FAULT.FMT R0124 0.00 DEFECT.FMT R0125 0.00 DOWNTIME.FMTA task issues the command: WSQL LOG
Since LOG=1, the selected file is DEFECT.FMT
DEFECT.FMT contains:
INSERT INTO Defects(Machine,Defect Type,Timestamp) VALUES (@@MC# NUMBER@,@@TYPE LIST 0 TYPES 0@,@@TOD REAL 6 2@)Note that "INSERT INTO" is a standard SQL keyword, "Defects" is the name of a table you defined in the database specified in the [ODBC] section of RTES32.INI, "Machine", "Defect Type" and "Timestamp" are fields that you defined in that table, using the appropriate data types.
MC#, TYPE, TYPES and TOD are RTES register names.
Reading data from a table
The RTES command RSQL provides a way to retrieve data from databases using SQL via ODBC.destination is the name of the first of a series of consecutive RTES registers that will receive the data.
The [ODBC]section in RTES32.CNF defines:
Example:
R0123 LAST 1.00 LAST_FAULT.FMT R0124 0.00 LAST_DEFECT.FMT R0125 0.00 LAST_DOWNTIME.FMT R0200 MC# 0.00 R0201 TYPE 0.00 R0202 TOD 0.00A task issues the command: RSQL LAST MC#
Since LOG=1, the selected file is LAST_DEFECT.FMT
LAST_DEFECT.FMT contains:
SELECT Machine,Defect Type,Timestamp FROM Defects ORDER BY TOD DESCNote that "SELECT .... FROM", "ORDER BY", "DESC" are standard SQL keyword, "Defects" is the name of a table you defined in the database specified in the [ODBC] section of RTES32.INI, "Machine", "Defect Type" and "Timestamp" are fields that you defined in that table, using the appropriate data types.
Example of how WSQL may be used to record live data into a database.
In the case of a remote database, it is assumed that the server is IIS (Internet Information Services) Version 6 or equivalent, that it accepts sql queries on port 80 (http) and that it has a compatible query handler. Note that the format of the tables in the database should follow certain guidelines if you intend to use the trend display facilities we supply. Contact FAI for assisstance. Logging alarm and change of state events. The LOGS parameter defines a table in the database that will be used by RTES32 to log the alarms and change of state events. This table must exist and must contain the following fields:Here is an example of how to create a table named "eventlogs" in MySql:
In this case, RTES32.INI will contain in the [ODBC] section:
LOGS=eventlogs