OpenDbCommandResult OpenDbCommand(OdId tOb, OpenDbCommandArg tArg)
tOb. SQL repository object moniker.
tArg. Opening parameters.
The OpenDbCommand operation opens the SQL object and returns the context for working with it.
To execute the operation, in the tObject parameter specify the repository SQL object moniker, and in the tArg parameter specify parameters of it opening. SQL object is one of the following types of repository objects:
The object moniker can be obtained on executing the GetObjects operation. The tArg field may contain opening mode (view or edit), values of the parameters to be sent to request, and the pattern for getting metadata. The pattern specifies the information to be retrieved on executing the operation. The operation results in the opened SQL object instance moniker, and also the metadata obtained according to the pattern specified in the tArg.metaGet field. Use the GetDbCommand and SetDbCommand operations to further work with the opened object. To close the opened SQL object instance, use the CloseDbCommand operation.
The example of opening SQL object for edit. The request contains the repository SQL object moniker. The response contains the opened SQL object instance moniker.
The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.
{
"OpenDbCommand" :
{
"tOb" :
{
"id" : "S1!M!9051"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
}
}
}
}
{
"OpenDbCommandResult" :
{
"id" :
{
"id" : "S1!M!S!M1"
}
}
}
public static OpenDbCommandResult OpenSQLObject(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tOpen = new OpenDbCommand()
{
tArg = new OpenDbCommandArg()
{
args = new DbCommandOpenArgs()
{
openForEdit = true
}
},
tOb = new OdId() { id = mb.id + "!" + FindObjectById(mb, id).k }
};
//Open SQL object
var tResult = somClient.OpenDbCommand(tOpen);
return tResult;
}
See also: