DatabaseResult OpenDatabase(OdId tOb, OpenDatabaseArg tArg)
tOb. Moniker of repository object that is database.
tArg. Operation execution parameters.
The OpenDatabase operation opens database an returns context for working with it.
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.
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.
{
"OpenDatabase" :
{
"tOb" :
{
"id" : "S1!M!174189"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
}
}
}
}
{
"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: