FNC_Mode FNC_GetPhaseEx(FNC_Phase *Phase, int option)
Syntax Elements
- Phase
- The processing phase in which the function was called and the action that the table function should perform.
- FNC_Phase is defined as:
typedef enum FNC_Phase { TBL_PRE_INIT=20, TBL_INIT=21, TBL_BUILD=22, TBL_FINI=23, TBL_END=24, TBL_ABORT=25, TBL_BUILD_EOF=26 } FNC_Phase;
- For the meanings of FNC_Phase values, see Processing Phase.
- option
- A value of 0-5.
- The sqltypes_td.h header file provides the following constants that you can use:
#define TBL_NOOPTIONS 0 #define TBL_LASTROW 1 #define TBL_NEWROW 2 #define TBL_NEWROWEOF 4
- A value of 3 specifies both TBL_NEWROW and TBL_LASTROW options.
- A value of 5 specifies both TBL_NEWROWEOF and TBL_LASTROW options.
- The following options are valid only for variable mode table functions. These options are ignored if you specify them in a constant mode table function.
Options Value Description and Usage TBL_NOOPTIONS 0 Indicates that no options are specified. Use this option when you only want to retrieve the processing phase in which the function was called.
TBL_LASTROW 1 Allows a function to determine when it is being passed the last input row on an AMP. Use this option if your table function processes a set of input rows before returning an output row. You must set the EOF indicator when using TBL_LASTROW to signal the end of the processing when the last row has been encountered. The function then moves from the TBL_BUILD phase to the TBL_BUILD_EOF phase where the row is built.
TBL_NEWROW 2 If this option is set and the phase is TBL_BUILD, the function is called with a new row with a phase of TBL_BUILD. Use this option when you want to get a new row on each function invocation.
If end of file, TBL_LASTROW or ProcessLastRow is true, then this option is ignored.
TBL_NEWROW and TBL_LASTROW 3 The behavior for both the TBL_NEWROW and TBL_LASTROW options are in effect. TBL_NEWROWEOF 4 If this option is set, and the phase is TBL_BUILD and EOF is set, then the function is called with a new row with a phase of TBL_BUILD. Use this option when you want to get a new row when EOF is signaled.
If end of file, TBL_LASTROW or ProcessLastRow is true, then this option is ignored.
TBL_NEWROWEOF and TBL_LASTROW 5 The behavior for both the TBL_NEWROWEOF and TBL_LASTROW options are in effect. - For example, calling FNC_GetPhaseEx with the option TBL_NOOPTIONS does not reset the TBL_NEWROW or TBL_NEWROWEOF behavior.
- If you specify TBL_LASTROW, the option remains in effect for the duration of the request. The TBL_NEWROW and TBL_NEWROWEOF options are set and reset based on the options specified during each call to FNC_GetPhaseEx where the option value is nonzero.