WagoAppSQL MySQL
WagoAppSQL MySQL
WagoAppSQL_MySQL
Release 1.6.1.0
Contents
1 Description 1
3 80 Status 10
3.1 Status (GVL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 eStatus (ENUM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 ParameterList (PARAMS) 14
5 VersionHistory (GVL) 16
6 Library Reference 17
i
CHAPTER 1
Description
This document is automatically generated. Because of this, the chapter 30 Visualization is not shown in this
document. If you are interested in getting to know more about visualization, we refer to the library manager of
e!Cockpit.
Subject to Changes
WAGO Kontakttechnik GmbH Co. KG reserves the right to provide for any alterations or modifications. WAGO
Kontakttechnik GmbH Co. KG owns all rights arising from the granting of patents or from the legal protection
of utility patents. Third-party products are always mentioned without any reference to patent rights. Thus, the
existence of such rights cannot be excluded.
Personnel Qualification
All tasks that are carried out with libraries made for the e!COCKPIT software must only be performed by qualified
electrical specialists instructed in PLC programming according to IEC 61131-3.
All tasks that have an effect on the properties or the behavior of automation hardware or software products must
only be performed by qualified employees with a thorough knowledge of handling the products concerned.
Intended Use of e!COCKPIT Libraries
Libraries created for the e!COCKPIT software are used to simplify the development of application projects in the
IEC 61131-3 programming languages.
For automation tasks, WAGO offers programmable logic controllers in a wide variety of performance classes.
In combination with a wide range of I/O modules, the controllers can process standard types of field signals.
Controllers can be implemented centrally or in decentralized configurations. The controllers offer interfaces for
the most commonly used fieldbuses for use in decentralized configurations. Fieldbus independent I/O modules
are then linked via fieldbus couplers. WAGO controllers offer a runtime environment for user programs called
e!RUNTIME. Software projects for implementation in e!RUNTIME environments can be created in e!COCKPIT.
The programming environment in e!COCKPIT is based on the established CODESYS 3 industrial standard. Users
with a previous knowledge of CODESYS 3 will thus find this environment largely familiar. The following pro-
gramming languages of the IEC 61131-3 standard are available:
• Structured Text (ST)
• Ladder Diagram (LD)
• Function Block Diagram (FBD)
• Instruction List (IL)
• Sequential Function Chart (SFC)
• Continuous Function Chart (CFC)
The individual programming languages can also be combined as required during the development of the software.
A portfolio of prepared libraries can be accessed for many frequently used functions in order to make software
development more efficient. This document provides an overview of the WagoAppSQL_MySQL that WAGO
offers for e!COCKPIT.
1
WagoAppSQL_MySQL, Release 1.6.1.0
1
Function blocks providing access to a MySQL database.
Further library information are summerized here:
Company WAGO
Title WagoAppSQL_MySQL
Version 1.6.1.0
Categories WAGO FunctionalView|Connectivity; WAGO LayerView|App; Application
Author WAGO/u010663
Placeholder WagoAppSQL_MySQL
2
3
WagoAppSQL_MySQL, Release 1.6.1.0
CHAPTER 2
Name Initial
MYSQL_TYPE_DECIMAL
MYSQL_TYPE_TINY
MYSQL_TYPE_SHORT
MYSQL_TYPE_LONG
MYSQL_TYPE_FLOAT
MYSQL_TYPE_DOUBLE
MYSQL_TYPE_NULL
MYSQL_TYPE_TIMESTAMP
MYSQL_TYPE_LONGLONG
MYSQL_TYPE_INT24
MYSQL_TYPE_DATE
MYSQL_TYPE_TIME
MYSQL_TYPE_DATETIME
InOut:
MYSQL_TYPE_YEAR
MYSQL_TYPE_NEWDATE
MYSQL_TYPE_VARCHAR
MYSQL_TYPE_BIT
246
MYSQL_TYPE_NEWDECIMAL
247
MYSQL_TYPE_ENUM
248
MYSQL_TYPE_SET
249
MYSQL_TYPE_TINY_BLOB
250
MYSQL_TYPE_MEDIUM_BLOB
251
MYSQL_TYPE_LONG_BLOB
252
MYSQL_TYPE_BLOB
2.1. Data types 4
253
MYSQL_TYPE_VAR_STRING
254
MYSQL_TYPE_STRING
WagoAppSQL_MySQL, Release 1.6.1.0
Name Type
sName STRING(MYSQL_MAX_IDENTIFIER_LENGTH)
udiLength UDINT
InOut:
eType eMySql_FieldTypes
wFlags WORD
bDecimals BYTE
This structure contains detail informations about each “column” or “data field” in a result set
Name Type
bProtocolVersion BYTE
sServerVersion STRING
dwThreadId DWORD
InOut:
abScrambleBuffer ARRAY [0..20] OF BYTE
wServerCapabilities WORD
bServerLanguageId BYTE
wServerStatus WORD
Interface variables
Function description
Remarks for aSqlStatement: You can modify the “length” and number of elements in “aSqlStatement” by
the global constants from the ParameterList: |- MYSQL_SQL_UPPER_BOUND: | Defines the UpperBound
of aSqlStatement, to provide a SQL statement | as “ARRAY [0..MYSQL_SQL_UPPER_BOUND] OF
STRING(MYSQL_SQL_LENGTH)” | - MYSQL_SQL_LENGTH: | Defines the Size in byte of an array ele-
ment of aSqlStatement, | to provide a SQL statement as “ARRAY [0..MYSQL_SQL_UPPER_BOUND] OF
STRING(MYSQL_SQL_LENGTH)”.
All non numeric SQL param values must be “quoted” with an apostroph(‘). Apostroph(‘) is also CoDesys-String-
Start-End-Identifier. To use an apostroph(‘) inside a CoDeSys-String type $27 or $’.
Example
Interface variables
Interface variables
Interface variables
Function description
Remarks for aSqlStatement: You can modify the “length” and number of elements in “aSqlStatement” by
the global constants from the ParameterList: | - MYSQL_SQL_UPPER_BOUND: | Defines the UpperBound
of aSqlStatement, to provide a SQL statement | as “ARRAY [0..MYSQL_SQL_UPPER_BOUND] OF
STRING(MYSQL_SQL_LENGTH)” | - MYSQL_SQL_LENGTH: | Defines the Size in byte of an array ele-
ment of aSqlStatement, | to provide a SQL statement as “ARRAY [0..MYSQL_SQL_UPPER_BOUND] OF
STRING(MYSQL_SQL_LENGTH)”.
All non numeric SQL param values must be “quoted” with an apostroph(‘). Apostroph(‘) is also CoDesys-String-
Start-End-Identifier. To use an apostroph(‘) inside a CoDeSys-String type $27 or $’.
Example
Note: Maximum length for field data are 500 bytes (TEXT, VARCHAR, ..)
Interface variables
Function description
The following return values may be received 16#00000000 => ‘SUCCESS’ 16#80006001 => ‘PARAM-ERROR:
Invalid param “row” - First row start on index 1. ; 16#80006002 => ‘PARAM-ERROR: Invalid param “col”
- First col start on index 1. ; 16#80006003 => ‘PARAM-ERROR: Requested row do not exist in “stQueryRe-
sult”; 16#80006004 => ‘PARAM-ERROR: Requested col do not exist in “stQueryResult”; 16#80006005 =>
‘CONVERT-ERROR: Length of col “x” exceed maximum of 500 bytes; 16#80006006 => ‘CONVERT-ERROR:
Field “x” use unsupported 8byte style for length informations’; 16#80006007 => ‘CONVERT-ERROR: Unknown
MySQL-Data-Type: “x”’; 16#80006008 => ‘CONVERT-ERROR: Unsupported MySQL-Data-Type: “x”’;
80 Status
10
WagoAppSQL_MySQL, Release 1.6.1.0
CHAPTER 4
ParameterList (PARAMS)
INT 40
MYSQL_MAX_ROW_COUNT Defines the maximum num
Constant this library
can process.
INT 500
MYSQL_MAX_ROW_SIZE Defines the maximum len
this library
can process.
BOOL FALSE
MYSQL_CLEAR_RESULT_SET_BEFORE_USE Clear the “stResultSet” b
used by func-
tion block
“MySql_Query”.
INT 80
MYSQL_MAX_IDENTIFIER_LENGTH Defines the maximum len
used by
structure
“MySql_FieldInfo”,
this library
can process.
INT 10
MYSQL_SQL_UPPER_BOUND Defines the upper bound
used by func-
tion blocks
“MySql_ExecSql”
and
“MySql_Query”
to provide a
SQL statement
as “ARRAY
[0..MYSQL_SQL_UP
OF
STRING(MYSQL_S
INT 100
MYSQL_SQL_LENGTH Defines the size in byte of
InOut: of “aSqlState-
ment”, used
by func-
15
tion blocks
“MySql_ExecSql”
and
CHAPTER 5
VersionHistory (GVL)
Name Type
WagoSysVersion.ProjectInfo
Info
WagoAppSQL_MySQL.library
date version author change
08.01.2019 1.6.1.0 u015842 Properties: free placeholder added
19.03.2018 1.6.0.5 u010640 FbMySql_Login.xError show pseudo error on normal logout
06.10.2017 1.6.0.4 u010663 Doku issues
12.06.2017 1.6.0.3 u010663 Bugfix FbMySql_Login
31.01.2017 1.6.0.2 u010640 Allow use of function blocks in different tasks
24.01.2017 1.6.0.1 u010640 FbMySQL_Query: Bugfix to support STORED-PROCEDURE’s
02.03.2016 1.6.0.0 u010663 Release
16
CHAPTER 6
Library Reference
CmpAsyncMgr
Library Identification:
Placeholder: CmpAsyncMgr
Default Resolution: CmpAsyncMgr, * (System)
Namespace: CmpAsyncMgr
Library Properties:
• LinkAllContent: False
• QualifiedOnly: True
• SystemLibrary: False
• Optional: False
CmpErrors Interfaces
Library Identification:
Name: CmpErrors Interfaces
Version: newest
Company: System
Namespace: CmpErrors
Library Properties:
• LinkAllContent: False
• QualifiedOnly: True
• SystemLibrary: False
• Optional: False
Standard
Library Identification:
Placeholder: Standard
Default Resolution: Standard, * (System)
Namespace: Standard
17
WagoAppSQL_MySQL, Release 1.6.1.0
Library Properties:
• LinkAllContent: False
• QualifiedOnly: False
• SystemLibrary: False
• Optional: False
SysCpuHandling
Library Identification:
Placeholder: SysCpuHandling
Default Resolution: SysCpuHandling, * (System)
Namespace: SysCpuHandling
Library Properties:
• LinkAllContent: False
• QualifiedOnly: True
• SystemLibrary: False
• Optional: False
SysSocketAsync
Library Identification:
Placeholder: SysSocketAsync
Default Resolution: SysSocketAsync, * (System)
Namespace: SysSocketAsync
Library Properties:
• LinkAllContent: False
• QualifiedOnly: True
• SystemLibrary: False
• Optional: False
SysTypes2 Interfaces
Library Identification:
Name: SysTypes2 Interfaces
Version: newest
Company: System
Namespace: SysTypes
Library Properties:
• LinkAllContent: False
• QualifiedOnly: False
• SystemLibrary: False
• Optional: False
18
WagoAppSQL_MySQL, Release 1.6.1.0
WagoSysBSDSocket
Library Identification:
Placeholder: WagoSysBSDSocket
Default Resolution: WagoSysBSDSocket, * (WAGO)
Namespace: WagoSysBSDSocket
Library Properties:
• LinkAllContent: False
• QualifiedOnly: True
• SystemLibrary: False
• Optional: False
WagoSysErrorBase
Library Identification:
Placeholder: WagoSysErrorBase
Default Resolution: WagoSysErrorBase, * (WAGO)
Namespace: WagoSysErrorBase
Library Properties:
• LinkAllContent: False
• QualifiedOnly: False
• SystemLibrary: False
• Optional: False
Library Parameter:
Parameter: RES_LOG_MAX_FILESIZE = 2000
Parameter: RES_LOG_MAX_FILES = 1
Parameter: RES_LOG_MAX_ENTRIES = 200
Parameter: RES_LOG_NAME = ‘WagoAppResultLogger’
WagoSysString
Library Identification:
Placeholder: WagoSysString
Default Resolution: WagoSysString, * (WAGO)
Namespace: WagoSysString
Library Properties:
• LinkAllContent: False
• QualifiedOnly: False
• SystemLibrary: False
• Optional: False
WagoSysVersion
Library Identification:
19
WagoAppSQL_MySQL, Release 1.6.1.0
Name: WagoSysVersion
Version: 1.0.0.0
Company: WAGO
Namespace: WagoSysVersion
Library Properties:
• LinkAllContent: False
• QualifiedOnly: False
• SystemLibrary: False
• Optional: False
WagoTypesCommon
Library Identification:
Placeholder: WagoTypesCommon
Default Resolution: WagoTypesCommon, * (WAGO)
Namespace: WagoTypes
Library Properties:
• LinkAllContent: False
• Optional: False
• QualifiedOnly: False
• SystemLibrary: False
• PublishSymbolsInContainer: True
WagoTypesErrorBase
Library Identification:
Placeholder: WagoTypesErrorBase
Default Resolution: WagoTypesErrorBase, * (WAGO)
Namespace: WagoTypesErrorBase
Library Properties:
• LinkAllContent: False
• QualifiedOnly: False
• SystemLibrary: False
• Optional: False
© WAGO Kontakttechnik GmbH & Co. KG, Germany 2018 – All rights reserved. For the avoidance of doubt,
this copyright notice does not only apply to the information above but also and primarily to the described library
itself. Please note that third-party products are always mentioned without reference to intellectual property rights,
including patents, utility models, designs and trademarks, accordingly the existence of such rights cannot be
excluded. WAGO is a registered trademark of WAGO Verwaltungsgesellschaft mbH.
20