GetDatabase

Syntax

DatabaseResult GetDatabase(OdId tOb, GetDatabaseArg tArg)

Parameters

tOb. Database moniker.

tArg. Operation execution parameters.

Description

The GetDatabase operation gets database metadata.

Comments

The operation gets parameters of connection to database server and a list of tables created on the database. To execute the operation, in the tOb field specify moniker of opened database instance, and in the tArg field specify parameters for getting metadata. The moniker can be obtained on executing the OpenDatabase operation. The operation results in the requested metadata.

Example

The example of getting information about server connection parameters that are set for the database. The request contains moniker of opened database instance and the pattern that determines whether it is necessary to get this information. The response contains requested information.

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">
<GetDatabase xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>S1!M!S!DB4</id>
  </tOb>
<tArg xmlns="">
<metaGet>
  <obInst>true</obInst>
  <connectionParams>true</connectionParams>
  </metaGet>
  </tArg>
  </GetDatabase>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetDatabaseResult 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>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="23" hf="0">
  <i>DB_DATA</i>
  <n>Database</n>
  <k>174189</k>
  <c>513</c>
  <p>9050</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<connectionParams>
  <useMetabaseLogonData>0</useMetabaseLogonData>
  <user />
  <pass />
<logonDataExt>
  <driver>MSSQL2012</driver>
  <server>%METABASE_SERVER%</server>
  <database>%METABASE_DATABASE%</database>
  <schema>dbo</schema>
  <unicode>1</unicode>
  <authentication>Password</authentication>
  <caseSensitive>0</caseSensitive>
<logonTask>
  <subName />
  </logonTask>
  <webServiceLogon>0</webServiceLogon>
  </logonDataExt>
  <useUnicode>1</useUnicode>
  <loginPrompt>1</loginPrompt>
  <useMetabaseCredentials>0</useMetabaseCredentials>
  <useApplicationRole>0</useApplicationRole>
  <supportDecimal>0</supportDecimal>
  <supportBinaryProtocol>1</supportBinaryProtocol>
  </connectionParams>
  </meta>
  </GetDatabaseResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetDatabase" :
{
"tOb" :
{
"id" : "S1!M!S!DB4"
},
"tArg" :
{
"metaGet" :
{
"obInst" : "true",
"connectionParams" : "true"
}
}
}
}

JSON response:

{
"GetDatabaseResult" :
{
"id" :
{
"id" : "S1!M!S!DB4"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "23",
"@hf" : "0",
"i" : "DB_DATA",
"n" : "Database",
"k" : "174189",
"c" : "513",
"p" : "9050",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"connectionParams" :
{
"useMetabaseLogonData" : "0",
"user" : "",
"pass" : "",
"logonDataExt" :
{
"driver" : "MSSQL2012",
"server" : "%METABASE_SERVER%",
"database" : "%METABASE_DATABASE%",
"schema" : "dbo",
"unicode" : "1",
"authentication" : "Password",
"caseSensitive" : "0",
"logonTask" :
{
"subName" : ""
},
"webServiceLogon" : "0"
},
"useUnicode" : "1",
"loginPrompt" : "1",
"useMetabaseCredentials" : "0",
"useApplicationRole" : "0",
"supportDecimal" : "0",
"supportBinaryProtocol" : "1"
}
}
}
}
public static DatabaseResult GetDBMetadata(string moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tGet = new GetDatabase()
{
tArg = new GetDatabaseArg()
{
metaGet = new DatabaseMdPattern()
{
connectionParams = true
}
},
tOb = new OdId() { id = moniker }
};
//Get metadata
var tResult = somClient.GetDatabase(tGet);
return tResult;
}

See also:

Working with Relational Objects of Repository