Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Executing DataAdminService utilities : PartitionMergeUtility class : Merge one partition into a target partition
 
Merge one partition into a target partition
To merge one partition into a target partition, specify the start-partition and target-partition parameters in the PartitionMergeUtility class. In the merge operation, the data from the start partition is moved into the target partition and then the start partition is deleted.
The following sample code shows how to merge one partition into a target partition:
block-level on error undo, throw

using Progress.Lang.Error from propath.
using OpenEdge.DataAdmin.DataAdminService from propath.
using OpenEdge.DataAdmin.Error.DataAdmin.ErrorHandler from propath.
using OpenEdge.DataAdmin.IPartitionPolicy from propath.
using OpenEdge.DataAdmin.IPartitionPolicyDetail from propath.
using OpenEdge.DataAdmin.IPartition from propath.
using OpenEdge.DataAdmin.ITable from propath.
using OpenEdge.DataAdmin.Util.PartitionMergeUtility from propath.

define variable service as DataAdminService no-undo.
define variable errorHandler as DataAdminErrorHandler no-undo.
define variable tbl as ITable no-undo.
define variable merge as PartitionMergeUtility no-undo.
define variable policy as IPartitionPolicy no-undo.
define variable start as IPartitionPolicyDetail no-undo.
define variable target as IPartitionPolicyDetail no-undo.

/* Start a service for the sptp database */
service = new DataAdminService("spmerge").

/* Retrieve the table */
tbl = service:GetTable("order").

/* Retrieve the partition policy */
policy = service:GetPartitionPolicy("pol")

start = policy:Details:Find("pol1").
target = policy:Details:Find("pol2").

/* Pass the start and target partitions to the utility for merging the start
partition into the target partition */
merge = new PartitionMergeUtility(start, target).
service:ExecuteUtility(merge).

catch e as Progress.Lang.Error:
errorHandler = new DataAdminErrorHandler().
errorHandler:Error(e).
end catch.

finally:
delete object service no-error.
end finally.