gtpc2mebC/C++ Language Support User's Guide

TO2_isTemp-Determine If Collection Is Temporary or Persistent

This function determines if the specified persistent identifier (PID) represents a temporary or persistent collection.

Format

#include <c$to2.h>
BOOL  TO2_isTemp (const TO2_PID_PTR pid_ptr,
                        TO2_ENV_PTR env_ptr);

pid_ptr
The pointer to the PID assigned to the collection to test.

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

Normal Return

A value of TO2_IS_TRUE is returned if the collection is temporary. A value of TO2_IS_FALSE is returned if the collection is persistent.

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 code is common for this function:

TO2_ERROR_ENV

TO2_ERROR_PID

Programming Considerations

Examples

The following example determines if the specified collection is temporary or persistent.

#include <c$to2.h>             /* Needed for TO2 API functions    */
#include <stdio.h>             /* APIs for standard I/O functions */
TO2_ENV_PTR      env_ptr;      /* PTR to the TO2 environment      */
TO2_PID          collect;      /* PTR to PID return field         */
TO2_ERR_CODE     err_code;

  ·
  ·
  ·
if ((TO2_isTemp(&collect, env_ptr)) == TO2_IS_FALSE) { err_code=TO2_getErrorCode(env_ptr); if (err_code ! = TO2_IS_FALSE) { printf (TO2_isTemp failed!\n") process_error (env_ptr); } else } printf("This is a persistent collection! \n"); } else { printf("This is a temporary collection! \n"); }

Related Information

None.