Below is the example of using the GetDbCommand operation to get information about SQL query text and field structure of the data set returned on executing the request. The request contains the opened SQL object instance moniker and the pattern that determines whether to get this information. The response contains requested information.
{ "GetDbCommand" : { "tDbCommand" : { "id" : "S2!M!S!M1" },
"tArg" : { "pattern" : { "obInst" : "true", "text" : "true", "fields" : "Get" } } } }
{ "GetDbCommandResult" : { "id" : { "id" : "S2!M!S!M1" }, "meta" : { "obInst" : { "obDesc" :
{ "@fullUrl" : "\/", "@isShortcut" : "0", "@isLink" : "0", "i" : "OBJ9051", "n" : "Query", "k" : "9051", "c" : "770", "p" : "9050", "h" : "0"
} }, "dirty" : "0", "type" : "Query", "text" : { "its" : { "it" : [
{ "driverID" : "ORCL8", "driverName" : "Oracle 9.x\10.x\11.x", "sqlText" : "" }, { "driverID" : "MSSQL2008", "driverName" : "Microsoft SQL Server 2008", "sqlText" : "" },
{ "driverID" : "MSSQL2012", "driverName" : "Microsoft SQL Server 2012", "sqlText" : "" }, { "driverID" : "OLEDB(ODBC HIVE)", "driverName" : "OLE DB(ODBC HIVE)", "sqlText" : "" },
{ "driverID" : "OLEDB(DB2)", "driverName" : "OLE DB(DB2)", "sqlText" : "" }, { "driverID" : "OLEDB(ODBC)", "driverName" : "OLE DB(ODBC)", "sqlText" : "" },
{ "driverID" : "OLEDB(VISTADB)", "driverName" : "OLE DB(VISTADB)", "sqlText" : "" }, { "driverID" : "OLEDB", "driverName" : "OLE DB", "sqlText" : "" },
{ "driverID" : "DB2", "driverName" : "DB2", "sqlText" : "" }, { "driverID" : "TRDT", "driverName" : "Teradata", "sqlText" : "" },
{ "driverID" : "POSTGRES(NO_LO)", "driverName" : "PostgreSQL without support of lo type", "sqlText" : "" }, { "driverID" : "POSTGRES", "driverName" : "PostgreSQL", "sqlText" : "" }
{ "driverID" : "SQLITE", "driverName" : "SQLite", "sqlText" : "" }, { "driverID" : "WSF", "driverName" : "Web Service Dal", "sqlText" : "" }
] }, "sqlText" : "SELECT * FROM T_COUNTRY" }, "fields" : { "its" : { "it" : [
{ "k" : "5", "id" : "ISO_CODE", "n" : "ISO_CODE", "vis" : "1", "dt" : "1", "size" : "255", "precision" : "0" }, {
"k" : "6", "id" : "NAME", "n" : "NAME", "vis" : "1", "dt" : "1", "size" : "255", "precision" : "0" }, { "k" : "7",
"id" : "POPULATION", "n" : "POPULATION", "vis" : "1", "dt" : "3", "size" : "22", "precision" : "2" }, { "k" : "8", "id" : "AREA",
"n" : "AREA", "vis" : "1", "dt" : "3", "size" : "22", "precision" : "2" }, { "k" : "9", "id" : "CURRENCY", "n" : "CURRENCY",
"vis" : "1", "dt" : "1", "size" : "255", "precision" : "0" } ] } } } } }
public static GetDbCommandResult GetSQLObjectParameters(DbCommandId moniker) { var somClient = new SomPortTypeClient(); //Proxy object for operation execution //Operation execution parameters var tGet = new GetDbCommand() { tArg = new GetDbCommandArg() { pattern = new DbCommandMdPattern() { fields = ListOperation.Get, text = true } }, tDbCommand = moniker }; //Get parameters var tResult = somClient.GetDbCommand(tGet); return tResult; }
See also: