[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Cannot dump current sequence values from runtime license

Status
Not open for further replies.
H

Håvard Danielsen

Guest
The Data Admin API is basically doing the same under the covers, but requires less code for the implementer. The main benefit is that it is meant to work also if the database implementation is changed. The code would look something like this. (I might have overlooked some functionality in the example) There should probably be a catch and error handling. Export: --------------------------------------------- block-level on error undo, throw. using OpenEdge.DataAdmin.DataAdminService from propath. using OpenEdge.DataAdmin.IDataAdminService from propath. using OpenEdge.DataAdmin.ISequence from propath. using OpenEdge.DataAdmin.ISequenceSet from propath. using OpenEdge.DataAdmin.Lang.Collections.IIterator from propath. define variable Service as IDataAdminService no-undo. define variable oSequenceSet as ISequenceSet no-undo. define variable oSequence as ISequence no-undo. define variable oIter as IIterator no-undo. define stream seq. output stream seq to "seqvals.d". Service = new DataAdminService("psi"). oSequenceSet = Service:GetSequences(). oIter = oSequenceSet:Iterator(). do while oIter:hasNext(): oSequence = cast(oIter:Next(),ISequence). export stream seq oSequence:name oSequence:CurrentValue. end. delete object Service. // is not garbage collected ------------- Import ------------------ block-level on error undo, throw. using OpenEdge.DataAdmin.IDataAdminService from propath. using OpenEdge.DataAdmin.DataAdminService from propath. using OpenEdge.DataAdmin.ISequence from propath. using OpenEdge.DataAdmin.ISequenceSet from propath. using OpenEdge.DataAdmin.Lang.Collections.IIterator from propath. define variable Service as IDataAdminService no-undo. define variable oSequenceSet as ISequenceSet no-undo. define variable oSequence as ISequence no-undo. define variable oIter as IIterator no-undo. define variable cName as character no-undo. define variable iSeq as int64 no-undo. define stream seq. input stream seq from "seqvals.d". Service = new DataAdminService("psi"). oSequenceSet = Service:GetSequences(). oIter = oSequenceSet:Iterator(). do while true: import stream seq cName iSeq. oSequence = oSequenceSet:Find(cName). oSequence:CurrentValue = iSeq. end. Service:UpdateSequences(oSequenceSet). delete object Service.

Continue reading...
 
Status
Not open for further replies.
Top