f$SQLRead_to_PG (f$SQLLies_in_PG)
f$SQLRead_to_PG (f$SQLLies_in_PG)
With this function, as many data records as desired are read into an indexed parameter group. The name of the parameter group must be entered without an index. If the parameter group is not indexed, only one data record is read. If the columns in the table and the parameters in the parameter group are not the same, only the parameters for which there is a column of the same name are filled. Zero values in the database result in the parameter being set to NOVAL. Data records are read until they cannot be found anymore or until the maximum index for the parameter group is reached.
Note: since it takes time to make the connection, a new connection should not be established for every SQL function.
Note: if data records are read from Excel with ODBC, the name of a data area can be given as the name of the table. This however has the disadvantage that the data area must sometimes be altered if changing the number of lines occupied. Alternatively, data can be read directly from a sheet if it is structured like a table. [Sheetname$] must be used as the table name.
Note: When reading data records into a dynamically created parameter group (Mode = 2 or Mode = 12), which contains parameter names with special characters (e.g. body$color), these are also defined with invalid special characters and created at runtime. However, these cannot be accessed directly by regular means / functions (not even via the PG button during debug mode). The status and the number of read records are output correctly. Cause: Parameter names must not contain special characters in ePOS. Workaround: Use the function f$GetParameter to read each single parameter value.
Syntax: | Status = f$SQLRead_to_PG(Channel, SQL ,PG, NameCount [,Mode]) | ||
| Argument | Type | Meaning |
| Channel | Integer | Channel number for the SQL connection |
| SQL | String | The SQL command activating access to data. |
| PG | String | The name of the indexed parameter group to be filled. |
| NameCount | String | The name of the parameter to which the count of data records read is written. |
| Mode | Integer | Managing parameter group changes: 0 : no action Note: the adjustment/definition of the parameter groups only occurs in the current function execution. The definition of the parameter group is not changed in the development system. 10 : the first index in the PG after the count of data records read is set to UNDEF. 11 - like 1 + the first index in the PG after the count of data records read is set to UNDEF. 12 - like 2 + the first index in the PG after the count of data records read is set to UNDEF. |
Result: | Integer | Error status: 0 :command was resolved correctly -1 :no data record found -2 :even more data records found -3 :the parameter group was not found -9999: the SQL command was not successful. In this case, the error status and error description can be calculated using: f$SQLError. | |
Example: | Channel = f$SQLConnect( db, user, password ) Status = f$SQLDisconnect( Channel ) | ||