gtpc2mht | C/C++ Language Support User's Guide |
This function migrates the specified collection by re-creating the collection and copying the contents of the old collection to the new collection one element at a time. The persistent identifier (PID) of the new collection is returned.
Format
#include <c$to2.h> long TO2_migrateCollection (TO2_PID_PTR pid_ptr, TO2_ENV_PTR env_ptr, TO2_PID_PTR rpid_ptr);
Normal Return
A positive value.
Error Return
A value of zero. Use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.
Programming Considerations
Examples
The following example creates a copy of a collection by using the current TPFCS collection format and new pool file addresses.
#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 source_pid; /* PID to be migrated */ TO2_PID migrated_pid; /* Migrated PID */
·
·
·
if (TO2_migrateCollection(&source_pid, env_ptr, &migrated_pid) == TO2_ERROR) { printf("TO2_migrateCollection failed! \n"); process_error(env_ptr); } else { printf("TO2_migrateCollection successful! \n"); }
Related Information
See TPF Application Programming for more information about commit scope.