UpdateMetadata

Short Description

Updates specified metadata objects in a repository.

Category

Write methods

Syntax

rc=UpdateMetadata(inMetadata,outMetadata,ns,flags,options);

Parameters

Method Parameters
Parameter
Type
Direction
Description
rc
N
out
Return code for the method. For more information, see Return Code.
inMetadata
C
in
Metadata property string that specifies the object and properties to be updated.
outMetadata
C
out
Returned metadata property string that includes the results of the Update operation.
ns
C
in
Namespace to use as the context for the request.
flags
L
in
OMI_IGNORE_NOTFOUND = 134217728
Prevents an Update operation from being canceled when a request specifies to update an object that does not exist.
OMI_RETURN_LIST = 1024
Specifies to return the identifiers of any dependent objects that were deleted as a result of the Update operation.
OMI_TRUSTED_CLIENT = 268435456
Determines whether the client can call this method. This flag is required.
OMI_UNLOCK=131072
Unlocks an object lock that is held by the caller.
OMI_UNLOCK_FORCE=262144
Unlocks an object lock that is held by another user.
options
C
in
Passed indicator for options.
<DOAS Credential="credHandle"/>
Enables a client to make a metadata request for another user. For more information, see <DOAS> Option.

Details

The UpdateMetadata method enables you to update the properties of existing metadata objects. It returns an error if the metadata object to be updated does not exist, unless the OMI_IGNORE_NOTFOUND (134217728) flag is set.
You can modify an object's attributes and associations, unless the association is designated as "required for add" in the metadata type documentation.
When modifying an association, you must specify a directive in the association name element in the input metadata property string. This directive indicates whether the association is being appended, modified, removed, or replaced in the object's association list. Different directives are supported for single and multiple associations. For information about these directives and general UpdateMetadata usage, see Updating Metadata Objects.
You must have a metadata identity defined on the SAS Metadata Server to set the OMI_UNLOCK (131072) and OMI_UNLOCK_FORCE (262144) flags. These flags unlock objects that were previously locked by the OMI_LOCK flag. The OMI_LOCK flag is set in the GetMetadata method to provide basic concurrency controls in preparation for an update. For an overview of multi-user concurrency controls supported by the SAS Open Metadata Interface, see Metadata Locking Options. When OMI_UNLOCK or OMI_UNLOCK_FORCE is set, only specified objects are unlocked. Associated objects are not unlocked.
Check the return code of an UpdateMetadata method call. A nonzero return code indicates that a failure occurred while trying to write the metadata. A nonzero return code means none of the changes in the method call were made.

Example 1: Standard Interface

The following is an example of how to issue the UpdateMetadata method regardless of the programming environment. The specified attribute values replace values stored for the object of the specified metadata type and object instance identifier.
<!-- Create a metadata list to be passed to UpdateMetadata -->

inMetadata= "<PhysicalTable Id="A2345678.A2000001" Name="Sales Table"
DataName="Sales" Desc="Sales for first quarter"/>";
ns= "SAS";
<!- OMI_TRUSTED_CLIENT flag ->
flags= 268435456;  
options= "";

rc=UpdateMetadata(inMetadata,outMetadata,ns,flags,options);

Example 2: DoRequest Method

The following is an example of an XML string that shows how to format the request in example 1 for the INMETADATA parameter of the DoRequest method.
<!-- XML string for inMetadata parameter of DoRequest method call -->

<UpdateMetadata>
   <Metadata>
      <PhysicalTable Id="A2345678.A2000001" Name="Sales Table" 
        DataName="Sales" Desc="Sales for first quarter"/>
   </Metadata>
   <NS>SAS</NS>
   <!- OMI_TRUSTED_CLIENT flag ->   
   <Flags>268435456</Flags>
   <Options/>
</UpdateMetadata>

Related Methods