block-level on error undo, throw
using OpenEdge.DataAdmin.Lang.Collections.IIterator from propath. using OpenEdge.DataAdmin.DataAdminService from propath. using OpenEdge.DataAdmin.IPartitionPolicy from propath. using OpenEdge.DataAdmin.IPartitionPolicyDetail from propath. using OpenEdge.DataAdmin.Util.PartitionSplitUtility from propath. using OpenEdge.DataAdmin.Error.DataAdminErrorHandler 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 iter as IIterator no-undo. define variable split as PartitionSplitUtility no-undo. define variable errorhandler as DataAdminErrorHandler no-undo. assign service = new DataAdminService(ldbname(1)) /* get the policy */ policy = service:GetPartitionPolicy("OrderPolicy") /* get an iterator of policy details that are still in composite*/ iter = policy:Details:Iterator(). do while iter:HasNext(): detail = cast(iter:Next(), IPartitionPolicyDetail). detail:IsSplitTarget = true. end. /* commit the splittarget changes */ service:UpdatePartitionPolicy(policy). /* Pass the policy and (optional) transaction size to the constructor to split the details from the composite partition */ split = new PartitionSplitUtility(policy, 100). 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. |
using OpenEdge.DataAdmin.ITable from propath.
using OpenEdge.DataAdmin.DataAdminService from propath. using OpenEdge.DataAdmin.IDataAdminService from propath. using OpenEdge.DataAdmin.Util.PartitionSplitUtility from propath. define variable myTable as ITable no-undo. define variable service as IDataAdminService no-undo. define variable split as PartitionSplitUtility no-undo. assign service = new DataAdminService(ldbname(1)) myTable = service:GetTable("myPolicy") /* Pass the table to the constructor to split the composite partition, set transaction size to 100 */ split = new PartitionSplitUtility(myTable, 100). service:ExecuteUtility(split). |