OpenDbCommand

Syntax

OpenDbCommandResult OpenDbCommand(OdId tOb, OpenDbCommandArg tArg)

Parameters

tOb. SQL repository object moniker.

tArg. Opening parameters.

Description

The OpenDbCommand operation opens the SQL object and returns the context for working with it.

Comments

To execute the operation, in the tObject field specify the repository SQL object moniker, and in the tArg field specify parameters of it opening. An 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.

Example

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<OpenDbCommand xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>S1!M!9051</id>
  </tOb>
<tArg xmlns="">
<args>
  <openForEdit>true</openForEdit>
  </args>
  </tArg>
  </OpenDbCommand>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenDbCommandResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>S1!M!S!M1</id>
  </id>
  </OpenDbCommandResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenDbCommand" :
{
"tOb" :
{
"id" : "S1!M!9051"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
}
}
}
}

JSON response:

{
"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:

Working with SQL Objects of Repository