![]() |
![]() |
Metadata API Class |
Category: | Read Method |
Syntax | |
Parameters | |
Details | |
Using _GET_METADATA_ | |
Examples | |
Example 1: Return Table Information | |
Example 2: Return Information about One Column |
Syntax |
CALL SEND(i_api, '_GET_METADATA_', l_rc, l_meta, <all>, <expand>); |
Parameter | Type | Description |
---|---|---|
i_api | Class | specifies the passed instance of METAAPI.CLASS. See Using the Metadata API Class. |
l_rc | N | specifies the return codes for the method. A nonzero code indicates failure and means that l_rc is an error list identifier. For the error list format, see Error Codes. |
l_meta | L | specifies the passed metadata property list for the object that is to be read. For the general format of this list, see Metadata Property List. |
all | N | specifies the passed indicator. Optional. Specifies whether the method should get all associated metadata for the object. |
expand | N | specifies the passed indicator. Optional. Specifies whether references to dependent objects should be expanded. |
Details |
specifies the passed metadata property list for the object that is to be read. At a minimum, you must supply a fully qualified ID in the l_meta list: reposid.typeid.instanceid.
You can supply a formatted l_meta list as input to the _GET_METADATA_ call, as shown in Example 1. In this case, only the sublists (properties) whose names have been passed in the formatted list will be returned. This will allow for selective retrieval of pieces of metadata about an object.
Alternatively, you could pass an l_meta list with only the ID property filled in and supply the all parameter to indicate to return all information about the requested object, as shown in Example 2. Getting all properties could take much longer than getting a select few.
specifies the passed indicator. Optional. Specifies whether the method should get all associated metadata for the object.
0 -- (default) return only the metadata that is specified in l_meta.
1 -- return all information known about the object that is specified in l_meta. However, if a sublist is returned that references another object, only the general identifying information for the referenced object will be returned.
Note that it takes longer to return a query if you ask for more information.
specifies the passed indicator. Optional. Specifies that any references to dependent objects should be expanded to include all properties for the referenced object (not only its general identifying information). For an explanation of dependent objects, see Independent and Dependent Metadata Objects.
0 -- (default) return all property lists unexpanded.
1 -- expand all dependent object references.
Note that it takes longer to return a query if you ask for more information.
Note: To understand which properties of a given metadata
type will be expanded, see the property tables for each type in Using the Metadata Type Dictionary.
Using _GET_METADATA_ |
It is possible that a sublist that is returned might contain identifiers of different types of objects, each with its own properties list format. Use the _IS_SUBTYPE_OF_ method to determine the type of the metadata identifier and thus the appropriate properties list format.
In addition to reading metadata objects in a repository, you can use _GET_METADATA_ to return a list of secondary metadata repositories. Specify the REPOSITORIES property in the l_meta list, and use the returned metadata identifier from the _SET_PRIMARY_REPOSITORY_ method. See Example: Set a Secondary Repository and Using _GET_METADATA_ to list secondary repositories.
Examples |
id='A000000E.WHDETAIL.A000002X'; l_meta=makelist(); l_meta=insertc(l_meta,id,-1,'ID'); /* * For now, retrieve only table properties. */ l_lib=makelist(); l_meta=insertl(l_meta,l_lib,-1,'LIBRARY'); l_cols=makelist(); l_meta=insertl(l_meta,l_cols,-1,'COLUMNS'); l_meta=insertc(l_meta,' ',-1,'TABLE NAME'); call send(i_api,'_GET_METADATA_',l_rc,l_meta); /* returns list: */ L_META( ID='A000000E.WHDETAIL.A000002X' LIBRARY=( ID='A0000001.WHLIBRY.A000000U' NAME='Warehouse Data Library' DESC='' )[5] COLUMNS=( ( ID='A000000E.WHCOLDTL.A0000032' NAME='PRODNUM' DESC='product number' )[9] ( ID='A000000E.WHCOLDTL.A0000034' NAME='PRODNAME' DESC='product name' )[11] ( ID='A000000E.WHCOLDTL.A0000036' NAME='PRODID' DESC='product id/abbreviation' )[13] ( ID='A000000E.WHCOLTIM.A00000FU' NAME='_LOADTM' DESC='DateTime Stamp of when row was loaded' )[15] )[7] TABLE NAME='PRODUCT' )[3]
l_cols=getniteml(l_meta,'COLUMNS'); l_col=getiteml(l_cols,4); /* * Get all information about column * (note get_all=1 parameter) */ call send(i_api,'_GET_METADATA_',l_rc,l_col,1); /* returns list: */ L_COL=( ID='A000000E.WHCOLTIM.A00000FU' DESC='DateTime Stamp of when row was loaded' NOTE=()[4083] INDEXES=()[4085] INPUT OBJECTS=()[4087] OUTPUT OBJECTS=()[4089] EXTENDED ATTRIBUTES=()[4096] TABLE=( ID='A000000E.WHDETAIL.A000002X' NAME='Product detail table' DESC='Contains information about all products' )[4091] FORMAT='DATETIME.' INFORMAT='DATETIME.' INPUT SOURCES=()[4093] LENGTH=8 OUTPUT TARGETS=()[4095] TYPE='N' CVALUE='' METADATA CREATED=' 04MAR1997:15:29:29' METADATA UPDATED=' 04MAR1997:15:29:29' NAME='_LOADTM' NVALUE=. )[3719]
![]() |
![]() |
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.