gtpc2mhwC/C++ Language Support User's Guide

TO2_reconstructCollection-Reconstruct Collection

This function reconstructs either the data chains or the internal mapping of a collection that has errors. A reconstruction report that contains a list of the actions taken on the collection along with any errors that cannot be resolved is returned. The errors that cannot be resolved must be corrected manually by the database administrator (DBA).

Format

#include <c$to2.h>
long  TO2_reconstructCollection (      TO2_PID_PTR            collectPtr,
                                       TO2_ENV_PTR            env_ptr,
                                 const TO2_OPTION_PTR         optionListPtr,
                                       TO2_PID_PTR            reconReportPtr,
                                       enum TO2_RECON_METHOD  reconMethod);

collectPtr
The pointer to the persistent identifier (PID) assigned to the collection that will be reconstructed.

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

optionListPtr
The pointer to a return options list from a TO2_createOptionList call or NULL if no options are required.

reconReportPtr
The pointer to where to return the temporary PID assigned to the sorted bag collection that represents the reconstruction report.

reconMethod
Specify one of the following:

TO2_RECON_DATA
Use this term to specify that the data chains of the collection will be rebuilt from the internal mapping of the collection.

TO2_RECON_KEYS
Use this term to specify that the key (index) internal mapping of the collection will be rebuilt from the data chains of the collection.

TO2_RECON_DIRECT
Use this term to specify that the directory internal mapping of the collection will be rebuilt from the data and key chains of the collection.

Normal Return

The normal return is a positive value, which indicates that processing was completed normally; it does not necessarily mean that the collection is free of errors.

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

Examples

The following example reconstructs the data chain of a collection. The example assumes that the data chain of the collection is corrupted, but the internal mapping is still intact.

#include <c$to2.h>               /* Needed for TO2 API Functions    */
#include <stdio.h>               /* APIs for standard I/O functions */
 
TO2_ENV_PTR    env_ptr;
TO2_PID        collect;
TO2_PID        reconReport;

  ·
  ·
  ·
/*******************************************************************/ /* Reconstruct the collection's data chain using the internal */ /* directory structure. */ /*******************************************************************/ if (TO2_reconstructCollection(&collect, env_ptr, NULL, &reconReport, TO2_RECON_DATA) == TO2_ERROR) { printf("TO2_reconstructCollection failed!\n"); process_error(env_ptr); } else printf("TO2_reconstructCollection successful!\n");

Related Information

TO2_validateCollection-Cause a Collection to Be Validated.