OpenDatabase

Syntax

DatabaseResult OpenDatabase(OdId tOb, OpenDatabaseArg tArg)

Parameters

tOb. Moniker of repository object that is database.

tArg. Operation execution parameters.

Description

The OpenDatabase operation opens database an returns context for working with it.

Comments

The operation gets access to database connection settings and gets a list of tables created in the database. To execute the operation, in the tOb field specify moniker of the repository object that is database, and in the tArg field specify parameters for opening database. In the tArg.metaGet field specify parameters for getting metadata. The operation results in the moniker of opened database instance and also requested metadata if the appropriate pattern was specified on executing the operation. The further work woth opened database instance is executed using the GetDatabase and SetDatabase operations. To close the opened database instance, use the CloseDatabase operation.

Example

The example of opening database for edit. The request contains database moniker in the repository. The response contains moniker of opened database instance.

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">
<OpenDatabase xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>S1!M!174189</id>
  </tOb>
<tArg xmlns="">
<args>
  <openForEdit>true</openForEdit>
  </args>
  </tArg>
  </OpenDatabase>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenDatabaseResult 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!DB4</id>
  </id>
  </OpenDatabaseResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenDatabase" :
{
"tOb" :
{
"id" : "S1!M!174189"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
}
}
}
}

JSON response:

{
"OpenDatabaseResult" :
{
"id" :
{
"id" : "S1!M!S!DB4"
}
}
}
public static DatabaseResult OpenDB(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tOpen = new OpenDatabase()
{
tArg = new OpenDatabaseArg()
{
args = new DatabaseOpenArgs()
{
openForEdit = true
}
},
tOb = new OdId() { id = mb.id + "!" + FindObjectById(mb, id).k }
};
//Open database
var tResult = somClient.OpenDatabase(tOpen);
return tResult;
}

See also:

Working with Relational Objects of Repository