[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Need to get all _files for all Connected DBs

  • Thread starter Thread starter Kondra Mohan Raju
  • Start date Start date
Status
Not open for further replies.
K

Kondra Mohan Raju

Guest
Object oriented way of doing this. USING OpenEdge.DataAdmin.Lang.Collections.IIterator FROM PROPATH. USING OpenEdge.DataAdmin.ITable FROM PROPATH. USING OpenEdge.DataAdmin.ITableSet FROM PROPATH. USING OpenEdge.DataAdmin.DataAdminService FROM PROPATH. DEFINE VARIABLE service AS DataAdminService NO-UNDO. DEFINE VARIABLE tblSet AS ITableSet NO-UNDO. DEFINE VARIABLE oiter AS IIterator NO-UNDO. DEFINE VARIABLE tbl AS ITable NO-UNDO. DEFINE VARIABLE iDBCount AS INTEGER NO-UNDO. DEFINE VARIABLE iTableCount AS INTEGER NO-UNDO. DEFINE TEMP-TABLE ttFile NO-UNDO FIELD ttDBName AS CHAR FIELD ttTblName AS CHAR. DO iDBCount = 1 TO NUM-DBS ON ERROR UNDO, RETURN ERROR: //get the service for the database service = NEW DataAdminService(LDBNAME(idbcount)). //get all the user tables for the database tblSet = service:GetTables(). //get the table count from the table collection iTableCount = tblSet:Count. //get the iterator for the tables oiter = tblSet:Iterator(). DO WHILE oIter:HasNext(): tbl = CAST(oIter:next(),ITable). CREATE ttFile. ASSIGN ttFile.ttDBName = LDBNAME(iDBCount) ttFile.ttTblName = tbl:NAME. END. //make sure to delete the objects in each iteration to reset them DELETE OBJECT Service NO-ERROR. DELETE OBJECT tblset NO-ERROR. DELETE OBJECT tbl NO-ERROR. END. FOR EACH ttFile NO-LOCK: DISP ttDBName ttTblName. END. CATCH e AS Progress.Lang.Error : MESSAGE e:GetMessage(1) SKIP e:callstack VIEW-AS ALERT-BOX. UNDO, THROW e. END CATCH.

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