Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Executing DataAdminService utilities : PartitionSplitUtility class : Split from an allocated partition detail
 
Split from an allocated partition detail
A partition detail that has already moved to an allocated partition can be re-allocated to other partitions. That is, you can move data from an allocated partition to one or more new partitions.
The following sample code shows how to split from an allocated partition:
using OpenEdge.DataAdmin.DataAdminService from propath.
using OpenEdge.DataAdmin.Error.DataAdminErrorHandler from propath.
using OpenEdge.DataAdmin.ITable from propath.
using OpenEdge.DataAdmin.Util.PartitionSplitUtility from propath.
using OpenEdge.DataAdmin.IPartitionPolicy from propath.
using OpenEdge.DataAdmin.IPartitionPolicyDetail from propath.

define variable service as DataAdminService no-undo.
define variable policy as IPartitionPolicy no-undo.
define variable detail as IPartitionPolicyDetail no-undo.
define variable errorhandler as DataAdminErrorHandler no-undo.
define variable split as PartitionSplitUtility no-undo.

/* Retrieve the partition policy */
assign
service = new DataAdminService(LDBNAME(1))
policy = service:GetPartitionPolicy("RPolicy").

/* add a new detail and mark as splitTarget */
detail = service:NewPartitionPolicyDetail("MyPolicy-A").
policy:Details:Add(detail).
detail:SetValue("A").
detail:IsSplitTarget=true.

/* add a new detail and mark as splitTarget */
detail = service:NewPartitionPolicyDetail("MyPolicy-B").
policy:Details:Add(detail).
detail:SetValue("B").
detail:IsSplitTarget=true.

/* commit the new details */
service:UpdatePartitionPolicy(policy).
/* Run PartitionSplitUtility to split the detail that currently has the data
for the new details (all values with A, B and C) */
detail = policy:Details:Find("MyPolicy-C").
split = new PartitionSplitUtility(detail).
service:ExecuteUtility(split).

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

finally:
delete object service no-error.
end finally.
Two new partition details, MyPolicy-A and MyPolicy-B, are created. Using PartionSplitUtility, data from the allocated partition detail, MyPolicy-C, is moved to the new partition details.