gtpc2mi6C/C++ Language Support User's Guide

TO2_validateCollection-Cause a Collection to Be Validated

This function validates the specified structure of the collection and returns a collection of error messages for any errors found.

Format

#include <c$to2.h>
long  TO2_validateCollection (const TO2_PID_PTR  pid_ptr,
                                    TO2_ENV_PTR  env_ptr,
                                    TO2_PID_PTR  validReportPtr);

pid_ptr
The pointer to the persistent identifier (PID) assigned to the collection that will be validated.

env_ptr
The pointer to the environment as returned by the TO2_createEnv function.

validReportPtr
The pointer to where to return the temporary PID assigned to the sorted bag collection that represents the validation error report.

Normal Return

The normal return is a positive value.

Error Return

An error return is indicated by a zero. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.

The following error codes are common for this function:

TO2_ERROR_ENV

TO2_ERROR_METHOD

Programming Considerations

A commit scope will be created for the TO2_validateCollection request. If the request is successful, the scope will be committed. If an error occurs while processing the TO2_validateCollection request, the scope will be rolled back.

Examples

The following example verifies the PID indicated and returns the error collection PID if applicable.

#include <c$to2.h>             /* Needed for TO2 API functions    */
#include <stdio.h>             /* APIs for standard I/O functions */
 
long         err_code;
TO2_ENV_PTR  env_ptr;          /* Pointer to TO2 environment       */
TO2_PID      collect,
TO2_PID      report_PidPtr;

  ·
  ·
  ·
if (TO2_validateCollection(&collect, env_Ptr, report_PidPtr) == TO2_ERROR) { printf("TO2_validateCollection failed!\n"); process_error(env_ptr); } else { printf("TO2_validateCollection successful!\n"); }

Related Information

TO2_reconstructCollection-Reconstruct Collection.