Porovnávané verzie
porovnané s
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
SQL_FETCH action
Function
The action reads one or more
rows preparedlines of the result of an SQL command prepared by the
actionSQL_PREPAREaction and optionally parameterizedby the
actionSQL_BINDIN action.
Declaration
Blok kódu | ||||
---|---|---|---|---|
| ||||
SQL_FETCH |
handleIdent_Int, retCodeIdent_Int [, maxRowsIdent_Int]
Parameters
handleIdent_Int | in | Identifier - the unique number (handle) of a connection. |
retCodeIdent_Int | out | Return code identifier. |
maxRowsIdent_Int | in | Identifier |
of the Int type - number of rows read |
at once (if not specified, the default value is 1). |
Return code
The value of the parameter transHandle_Int. See the table of error codes. It is possible to get extended error information.
Description
The action reads given number of rows and assigns their values to the local variables specified by the action SQL_PREPARE action.
MaxRowsIdent_Int is to be used only for the 3rd declaration type of the action SQL_PREPARE. If the value of the parameter is other than 1 for the declaration types 1, 2, or less than 1, the action generates the error _ERR_RANGE_ERROR.
Maximum The maximum number of returned rows is limited by a Database configuration parameter Maximum returned rows. If the number of available rows exceeds this limit, the local structure _locVarRecordIdent specified as the parameter of action SQL_PREPARE will contain first Maximum returned rows and retCodeIdent_Int will be set to error code _ERR_DATABASE_ROWS_LIMIT.
If no row has been read, the value of the parameter retCodeIdent_Int is 22 (_ERR_NO_DATA).
MaxRowsIdent_Int is to be used only for the 3rd declaration type of the action SQL_PREPARE. If the value of the parameter is other than 1 for the declaration types 1, 2, or less than 1, the action generates the error _ERR_RANGE_ERROR.
Maximum The maximum number of returned rows is limited by a Database configuration parameter Maximum returned rows. If the number of available rows exceeds this limit, the local structure _locVarRecordIdent specified as the parameter of action SQL_PREPARE will contain first Maximum returned rows and retCodeIdent_Int will be set to error code _ERR_DATABASE_ROWS_LIMIT.
If no row has been read, the value of the parameter retCodeIdent_Int is 22 (_ERR_NO_DATA).
Example
Work with a database (actions SQL_ ...).
Blok kódu | ||||
---|---|---|---|---|
| ||||
INT _handle ; handle to database INT _retCode ; return code TEXT _name ; product name TEXT _type ; product type SQL_CONNECT MyDatabase, _handle, _retCode SQL_PREPARE _handle, _retCode, _sqlNpar BIND _name, _type DO_LOOP SQL_FETCH _handle, _retCode EXIT_LOOP _retCode # _ERR_NO_ERROR ; data processing goes here END_LOOP SQL_FREE _handle SQL_DISCONNECT _handle |
Related topics