After the database schema has been scanned into a repository database, the schema can be easily navigated from Microsoft® Visual Basic® or Microsoft Visual C++® using the repository API. For example, the following Visual Basic code navigates in the following order: DataSource, Catalog, Schema, Table, Column, DataType.
Set IfD = Repos.object(OBJID_IDbmDataSource) For Each datasource In IfD.ObjectInstances...For Each catalog In datasource("_DataSource").DeployedCatalogs...For Each schema In catalog("_Catalog").Schemas...For Each table In schema("_Schema").TablesIf QI(table, "IDbmTable") Then...For Each column In table("_Table").Columns...Set datatype = column("_Column").Attribute.Item(1)NextEnd IfNextNextNext Next Private Function QI(o As RepositoryObject, name As String) As Boolean On Error GoTo FailDim r As RepositoryObjectSet r = o.Interface(name)QI = TrueExit Function Fail: QI = False End Function