Aggregate

Aggregate AEs are called from Aggregate SQL Functions.

Data structures

struct NZAEAGG_HANDLE
The Aggregate Handle. An opaque handle used with Aggregate AE functions.
struct NzaeAggAccumulate
The Accumulate structure.
struct NzaeAggFieldFunctions
Read and write record functions for Aggregation.
struct NzaeAggFinalResult
The Final Result structure.
struct NzaeAggInitializeState
The InitializeState structure.
struct NzaeAggMerge
The Merge structure.
struct NzaeAggMetadata
NzaeAggMetatadata.
struct NzaeAggReadOnlyFieldFunctions
Read-only record functions for Aggregation.

Functions

void nzaeAggClose(NZAEAGG_HANDLE handle)
Closes the handle when done.
NzaeAggRcCode nzaeAggGetEnv(NZAEAGG_HANDLE handle, const char *name, const char **result)
Gets the AE or system environment variable. The AE variable has precedence.
void nzaeAggGetFirstEnvironmentEntry(NZAEAGG_HANDLE handle, NzaeEnvironmentEntry *entry)
Returns the first environment entry.
AeUserCode nzaeAggGetLastErrorCode(NZAEAGG_HANDLE handle)
Gets the code for the last error that occurred.
const char* nzaeAggGetLastErrorText(NZAEAGG_HANDLE handle)
Gets the message text for the last error that occurred.
const char* nzaeAggGetLibraryFullPath(NZAEAGG_HANDLE h, const char *libraryName, bool caseSensitive)
Gets the file path for the library name.
NzaeSharedLibraryInfo* nzaeAggGetLibraryInfo(NZAEAGG_HANDLE h)
Returns NzaeSharedLibraryInfo for the requested Shared Library information.
NzaeSharedLibraryInfo* nzaeAggGetLibraryProcessInfo(NZAEAGG_HANDLE h)
Returns NzaeSharedLibraryInfo shared library information for the process. Returns NULL if the AE is not Remote. The AE system owns the memory from this call.
bool nzaeAggGetNextEnvironmentEntry(NZAEAGG_HANDLE handle, NzaeEnvironmentEntry *entry)
Returns the next environment entry.
int nzaeAggGetNumberOfParameters(NZAEAGG_HANDLE h)
Returns the number of parameters.
const char* nzaeAggGetParameter(NZAEAGG_HANDLE h, int index)
Returns the parameter.
NzaeAggRcCode nzaeAggGetRuntime(NZAEAGG_HANDLE handle, NzaeRuntime *arg)
Gets runtime information about the AE Aggregate.
NzaeAggType nzaeAggGetType(NZAEAGG_HANDLE handle)
Returns the Aggregation Type.
NzaeAggRcCode nzaeAggLog(NZAEAGG_HANDLE handle, NzaeLogLevel level, const char *mes-sage)
Logs the specified message.
void* nzaeAggNext(NZAEAGG_HANDLE handle, NzaeAggMessageType *messageType)
Gets the next aggregation message.
NzaeAggRcCode nzaeAggPing(NZAEAGG_HANDLE handle)
Indicates that the AE Aggregate is still active and not hanging.
NzaeAggRcCode nzaeAggUpdate(NZAEAGG_HANDLE handle)
Updates the result to the database.
NzaeAggRcCode nzaeAggUserError(NZAEAGG_HANDLE handle, const char *_template,...)
Indicates that the AE encountered an error condition.

Enumerations

enum NzaeAggMessageType { NZAEAGG_NOT_SET= -2, NZAEAGG_ERROR= -1, NZAEAGG_END= 0, NZAEAGG_INITIALIZE= 1, NZAEAGG_ACCUMULATE= 2, NZAEAGG_MERGE= 3, NZAEAGG_FINAL_RESULT= 4 }
Aggregate message types.
enum NzaeAggRcCode { NZAEAGG_RC_ERROR= -1, NZAEAGG_RC_NORMAL= 0 }
Return codes from nzaeAgg aggregate functions.
enum NzaeAggType { NzaeAggUnknown, NzaeAggGrouped, NzaeAggAnalytic }
The Aggregate Function Type.

Detailed description

Aggregate AEs are called from Aggregate SQL Functions.

Function documentation

void nzaeAggClose(NZAEAGG_HANDLE handle)
Closes the handle when done.
Parameters:

handle

The aggregate handle.

NzaeAggRcCode nzaeAggGetEnv(NZAEAGG_HANDLE handle, const char *name, const char **result)
Gets the AE or system environment variable. The AE variable has precedence.
Parameters:
  • handle

    The aggregate handle.

  • name

    The variable name.

  • result

    The output variable value or NULL if not found.

    Returns

    NzaeAggRcCode

    The aggregate return code.
void nzaeAggGetFirstEnvironmentEntry(NZAEAGG_HANDLE handle, NzaeEnvironmen-tEntry *entry)
Returns the first environment entry.
Parameters:
  • handle

    The aggregate handle.

  • NzaeEnvironmentEntry entry

    The first entry.

    This function call is followed by repeated calls to nzaeGetNextEnvironmentEntry. The AE sys-tem owns the memory from this call.

AeUserCode nzaeAggGetLastErrorCode(NZAEAGG_HANDLE handle)
Gets the code for the last error that occurred.
Parameters:
  • handle

    The aggregate handle.

    Returns

    AeUserCode

    The aggregate error code.

const char* nzaeAggGetLastErrorText(NZAEAGG_HANDLE handle)
Gets the message text for the last error that occurred.
Parameters:
  • handle

    The aggregate handle.

    Returns

    The text of the last error.

const char* nzaeAggGetLibraryFullPath(NZAEAGG_HANDLE h, const char *libraryName, bool caseSensitive)
Gets the file path for the library name.
Parameters:
  • h

    The aggregate handle.

  • libraryName

    The library name.

  • caseSensitive

    If TRUE, the lookup is case-sensitive.

    Returns

    The file path if found; NULL otherwise.

    Returns NULL if the library is not found. The AE system owns the memory from this call.

NzaeSharedLibraryInfo* nzaeAggGetLibraryInfo(NZAEAGG_HANDLE h)
Returns NzaeSharedLibraryInfo for the requested Shared Library information.
Parameters:
  • h

    The aggregate handle.

    Returns

    NzaeSharedLibraryInfo

    The Shared Library information.

    The AE system owns the memory from this call.

NzaeSharedLibraryInfo* nzaeAggGetLibraryProcessInfo(NZAEAGG_HANDLE h)
Returns NzaeSharedLibraryInfo shared library information for the process. Returns NULL if the AE is not Remote. The AE system owns the memory from this call.
Parameters:
  • h

    The aggregate handle.

    Returns

    NzaeSharedLibraryInfo

    The Shared Library information.

bool nzaeAggGetNextEnvironmentEntry(NZAEAGG_HANDLE handle, NzaeEnvironmentEntry *entry)
Returns the next environment entry.
Parameters:
  • handle

    The aggregate handle.

  • NzaeEnvironmentEntry entry

    The next entry.

    Returns

    FALSE on end.

    The Shared Library information.

    The first nzaeGetNextEnvironmentEntry must follow a call to nzaeGetFirstEnvironmentEntry. Returns FALSE on end. Key names may repeat but the current version of a keyname is given last. The AE system owns the memory from this call.

int nzaeAggGetNumberOfParameters(NZAEAGG_HANDLE h)
Returns the number of parameters.
Parameters:
  • h

    The aggregate handle.

    Returns

    The number of parameters.
const char* nzaeAggGetParameter(NZAEAGG_HANDLE h, int index)
Returns the parameter.
Parameters:
  • h

    The aggregate handle.

  • index

    The parameter index.

    Returns

    The parameter value.

    The Index is zero-based.

NzaeAggRcCode nzaeAggGetRuntime(NZAEAGG_HANDLE handle, NzaeRuntime *arg)
Gets runtime information about the AE Aggregate.
Parameters:
  • h

    The aggregate handle.

  • NzaeRuntime arg

    The caller-created runtime to be filled out.

    Returns

    NzaeAggRcCode

    The aggregate return code.

const char* nzaeAggGetSystemLogFileName()
Gets the AE Aggregate System Log File name.
Returns

The log file name.

NzaeAggType nzaeAggGetType(NZAEAGG_HANDLE handle)
Returns the Aggregation Type.
Parameters:
  • handle

    The aggregate handle.

    Returns

    NzaeAggType

    The aggregate type.

NzaeAggRcCode nzaeAggLog(NZAEAGG_HANDLE handle, NzaeLogLevel level, const char *message)
Logs the specified message.
Parameters:
  • handle

    The aggregate handle.

  • NzaeLogLevel level

    The log level.

  • message

    The log message.

    Returns

    NzaeAggRcCode

    The aggregate return code.

void* nzaeAggNext(NZAEAGG_HANDLE handle, NzaeAggMessageType *messageType)
Gets the next aggregation message.
Parameters:
  • handle

    The aggregate handle.

  • NzaeAggMessageType messageType

    The returned message type.

    Returns

    The structure as void * .

    Returns a NzaeAggInitialize, NzaeAggAccumulate , NzaeAggMerge , or NzaeAggFinalResult struct point-er. Use the messageType parameter to determine the return type, end of input, and error. Returns NULL on error or at the end of data.

NzaeAggRcCode nzaeAggPing(NZAEAGG_HANDLE handle)
Indicates that the AE Aggregate is still active and not hanging.
Parameters:
  • handle

    The aggregate handle.

    Returns

    NzaeAggRcCode

    The aggregate return code.

NzaeAggRcCode nzaeAggUpdate(NZAEAGG_HANDLE handle)
Updates the result to the database.
Parameters:
  • handle

    The aggregate handle.

    Returns

    NzaeAggRcCode

    A NzaeAggInitialize, NzaeAggAccumulate , NzaeAggMerge , or NzaeAggFinalResult struct pointer. Can be NULL on error.

NzaeAggRcCode nzaeAggUserError(NZAEAGG_HANDLE handle, const char *_template,...)
Indicates that the AE encountered an error condition.
Parameters:
  • handle

    The aggregate handle.

  • _template

    The printf-style template.

    Returns

    NzaeAggRcCode

    The AE is complete and should exit after this call. The message is built like printf.

Enumeration type documentation

enum NzaeAggMessageType
Aggregate message types.

NZAEAGG_NOT_SET

NZAEAGG_ERROR

NZAEAGG_END

NZAEAGG_INITIALIZE

NZAEAGG_ACCUMULATE

NZAEAGG_MERGE

NZAEAGG_FINAL_RESULT

enum NzaeAggRcCode
Return codes from nzaeAgg aggregate functions.

NZAEAGG_RC_ERROR

NZAEAGG_RC_NORMAL

enum NzaeAggType
The Aggregate Function Type.

NzaeAggUnknown

NzaeAggGrouped

NzaeAggAnalytic