Zum Hauptinhalt springen

TLP — Target-Link-Protocol — Standard Protocol

With each SQL request to the database, the Connector is provided with information prior to execution.

Request to the Connector

AttributeData TypeDescriptionDefault
MRPNullterminierter StringMax Return Parameter
<MRP Value>Nullterminierter StringMinimum 1Nicht optional
MRNull-terminated StringMax Rows
<MR Value>Null-terminated StringMinimum 1Not optional
MCNull-terminated StringMax Columns
<MC Value>Null-terminated StringMinimum 1Not optional
MSNull-terminated StringMax String
<MS Value>Null-terminated StringMinimum 1Not optional
CTNull-terminated StringConnector Timeout
<CT Value>Null-terminated String0 = no Timeout, Connection remains open, >0 = Timeout in secondsNot active
CNNull-terminated StringColumn Names
<CN Value>Null-terminated String0 = no Column names, 1 = Column names (default 1)1
CSNull-terminated StringCut String
<CS Value>Null-terminated StringString of each value is shortened to length CSNot active
SNull-terminated StringString (SQL Request)
<S Value>Null-terminated StringMinimum 1 characterNot optional
TNull-terminated StringTransmit Request

<MRP><<sub>NUL</sub>><MRP Value><<sub>NUL</sub>> Maximum number of return parameter which can be stored in the control system

<MR><<sub>NUL</sub>><MR Value><<sub>NUL</sub>> Maximum number of datasets which can be stored in the control system

<MC><<sub>NUL</sub>><MC Value><<sub>NUL</sub>> Maximum number of columns which can be stored in the control system

<MS><<sub>NUL</sub>><MS Value><<sub>NUL</sub>> Length of the string variable in the control system

<CT><<sub>NUL</sub>><CT Value><<sub>NUL</sub>> Timeout Connector (optional)

<CN><<sub>NUL</sub>><CN Value><<sub>NUL</sub>> A database request also returns the column names in addition to the data, or not. (optional)

<CS><<sub>NUL</sub>><CS Value><<sub>NUL</sub>> A database request also returns data if the size of the database value exceeds the defined maximum string length (MS). The value will be cut off after the CS value, and the error is ignored. (optional)

<S><<sub>NUL</sub>><S Value><<sub>NUL</sub>> SQL request string

<S><<sub>NUL</sub>><S Value><<sub>NUL</sub>> If the SQL request string is too large for the control system, it can be sent to the connector in a dissected form. (optional)

<T><<sub>NUL</sub>> Start command to send the SQL request string to the database

Examples:

MRP<sub>NUL</sub>15<sub>NUL</sub>MR<sub>NUL</sub>80<sub>NUL</sub>MC<sub>NUL</sub>40<sub>NUL</sub>MS<sub>NUL</sub>255<sub>NUL</sub>S<sub>NUL</sub>SELECT id, iParam1, fParam2, sText1 FROM tTable1<sub>NUL</sub>T<sub>NUL</sub>

MRP<sub>NUL</sub>15<sub>NUL</sub>MR<sub>NUL</sub>80<sub>NUL</sub>MC<sub>NUL</sub>40<sub>NUL</sub>MS<sub>NUL</sub>255<sub>NUL</sub>CS <sub>NUL</sub>80<sub>NUL</sub>CN<sub>NUL</sub>0<sub>NUL</sub>

S<sub>NUL</sub>SELECT id, iParam1, fParam2, sText1 FROM tTable1<sub>NUL</sub>

S<sub>NUL</sub>WHERE id < 4<sub>NUL</sub>

T<sub>NUL </sub>

Response from the Connector

AttributeData TypeDescription
RSNull-terminated StringReturn State
<RS Value>Null-terminated String
RPNullterminierter StringReturn Parameter
<RP Value>Nullterminierter String
RRNull-terminated StringResult Rows
< RR Value>Null-terminated String
RCNull-terminated StringResult Columns
< RC Value>Null-terminated String
RNNull-terminated StringResult Column names
< RN Values>Null-terminated String
RDNull-terminated StringResult Data
< RD Values>Null-terminated String

<RS><<sub>NUL</sub>><RS Value><<sub>NUL</sub>> RS Value = 0 Okay, data will follow

RS Value > 0 Error code, no data will follow

Bei RS Value = 0

<RR><<sub>NUL</sub>><RR Value><<sub>NUL</sub>> RR Value Number datasets

<RC><<sub>NUL</sub>><RC Value><<sub>NUL</sub>> RC Value Number columns

Only if RP Value > 0 return parameter will follow (RPD)

RPD<sub>NUL </sub>123<sub>NUL</sub>321<sub>NUL</sub>abc<sub>NUL</sub>

If RC Value > 0 data will follow, else RR Value contains the number of the processed datasets (Update, Delete…)

<RN><<sub>NUL</sub>> RN followed by all column names

For iC = 1 to RC

<RN Value[iC]> <<sub>NUL</sub>>

Next iC

<RD><<sub>NUL</sub>> RD followed by all data

For iR = 1 to RR

For iC = 1 to RC

<RD Value[iR, iC]> <<sub>NUL</sub>>

Next iC

Next iR

Example:

RS<sub>NUL</sub>0<sub>NUL</sub>RP<sub>NUL</sub>3<sub>NUL</sub>RR<sub>NUL</sub>3<sub>NUL</sub>RC<sub>NUL</sub>4<sub>NUL </sub>RPD<sub>NUL </sub>123<sub>NUL</sub>321<sub>NUL</sub>abc<sub>NUL </sub>RN<sub>NUL </sub>id<sub>NUL</sub>iParam1<sub>NUL</sub>fParam2<sub>NUL</sub>sText1<sub>NUL </sub>RD<sub>NUL </sub>1<sub>NUL</sub>501<sub>NUL</sub>10.1<sub>NUL</sub>Text Example 1<sub>NUL</sub>

2<sub>NUL</sub>502<sub>NUL</sub>10.2<sub>NUL</sub>Text Example 2<sub>NUL</sub>

3<sub>NUL</sub>503<sub>NUL</sub>10.3<sub>NUL</sub>Text Example 3<sub>NUL</sub>

Error Codes Return-Value

Error NumberError Description
0No error, request data to follow
1Unknown SQL Command
2Request returns more datasets than defined by MaxRows, modify request or increase MaxRows
3Request returns more columns than defined by MaxColumns, modify request or increase MaxColumns
4Request returns more data than defined by buffer size (only with target type Siemens)
Modify request or increase Buf. Size in the Connector and in the application.
5Request returns minimal one value that is bigger than defined by MaxStringLength, modify request or increase MaxStringLength
10Internal Connector error
11Internal Connector error, cannot open database
23Request string is empty
24Number MaxRows not defined
25Number MaxColumns not defined
29Size MaxStringLength not defined
>100Error numbers of the ODBC database connection (some known error numbers are attached)
40002General error during SQL request, request string is invalid

Handshake

Error-free Request

Abortion during Request

Error during Request