Changing SQL Object Parameters

Below is the example of using the SetDbCommand command to change request text and set DBMS command parameters. The request contains moniker of opened DBMS command instance, updated metadata and the pattern that determines whether to change request and parameters. The response contains updated information about DBMS command metadata. To save applied changes after the SetDbCommand operation also execute the SaveObject or SaveObjectAs operation.

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">
<SetDbCommand xmlns="http://www.fsight.ru/PP.SOM.Som">
<tDbCommand xmlns="">
  <id>S1!M!S!M2</id>
  </tDbCommand>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <text>true</text>
  <openArgs>true</openArgs>
  </pattern>
<meta>
  <type>Command</type>
<text>
  <sqlText>Insert Into T_COUNTRY (ISO_CODE, NAME) values (:ISO_CODE, :NAME)</sqlText>
  </text>
<openArgs>
<args>
<it>
  <k>4294967295</k>
  <id>ISO_CODE</id>
  <n>ISO_CODE</n>
  <vis>true</vis>
  <value>CA</value>
  <dt>1</dt>
  </it>
<it>
  <k>4294967295</k>
  <id>NAME</id>
  <n>NAME</n>
  <vis>true</vis>
  <value>Canada</value>
  <dt>1</dt>
  </it>
  </args>
  </openArgs>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <text>true</text>
  <openArgs>true</openArgs>
  </metaGet>
  </tArg>
  </SetDbCommand>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetDbCommandResult 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!M2</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="1" hf="0">
  <i>OBJ9054</i>
  <n>DBMS command</n>
  <k>9054</k>
  <c>3841</c>
  <p>9050</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>1</dirty>
  <type>Command</type>
<text>
<its>
<it>
  <driverID>ORCL8</driverID>
  <driverName>Oracle</driverName>
  <sqlText />
  </it>
<it>
  <driverID>MSSQL</driverID>
  <driverName>Microsoft SQL Server 6.x\7.x\2000</driverName>
  <sqlText />
  </it>
<it>
  <driverID>MSSQL2005</driverID>
  <driverName>Microsoft SQL Server 2005</driverName>
  <sqlText />
  </it>
<it>
  <driverID>MSSQL2008</driverID>
  <driverName>Microsoft SQL Server 2008</driverName>
  <sqlText />
  </it>
<it>
  <driverID>MSSQL2012</driverID>
  <driverName>Microsoft SQL Server 2012\2014\2016</driverName>
  <sqlText />
  </it>
<it>
  <driverID>MSSQL2012ODBC</driverID>
  <driverName>Microsoft SQL Server (ODBC)</driverName>
  <sqlText />
  </it>
<it>
  <driverID>ODBC</driverID>
  <driverName>Generic ODBC</driverName>
  <sqlText />
  </it>
<it>
  <driverID>OLEDB(ODBC HIVE)</driverID>
  <driverName>OLE DB(ODBC HIVE)</driverName>
  <sqlText />
  </it>
<it>
  <driverID>OLEDB(DB2)</driverID>
  <driverName>OLE DB(DB2)</driverName>
  <sqlText />
  </it>
<it>
  <driverID>OLEDB(ODBC)</driverID>
  <driverName>OLE DB(ODBC)</driverName>
  <sqlText />
  </it>
<it>
  <driverID>OLEDB(VISTADB)</driverID>
  <driverName>OLE DB(VISTADB)</driverName>
  <sqlText />
  </it>
<it>
  <driverID>OLEDB</driverID>
  <driverName>OLE DB</driverName>
  <sqlText />
  </it>
<it>
  <driverID>DB2</driverID>
  <driverName>DB2</driverName>
  <sqlText />
  </it>
<it>
  <driverID>TRDT</driverID>
  <driverName>Teradata</driverName>
  <sqlText />
  </it>
<it>
  <driverID>POSTGRES(NO_LO)</driverID>
  <driverName>Greenplum/Pivotal HD Hawq</driverName>
  <sqlText />
  </it>
<it>
  <driverID>POSTGRES</driverID>
  <driverName>PostgreSQL</driverName>
  <sqlText />
  </it>
<it>
  <driverID>SQLITE</driverID>
  <driverName>SQLite</driverName>
  <sqlText />
  </it>
<it>
  <driverID>WSF</driverID>
  <driverName>WEB Service</driverName>
  <sqlText />
  </it>
<it>
  <driverID>VERTICA</driverID>
  <driverName>Vertica</driverName>
  <sqlText />
  </it>
  </its>
  <sqlText>Insert Into T_COUNTRY (ISO_CODE, NAME) values (:ISO_CODE, :NAME)</sqlText>
  </text>
<openArgs>
<args>
<it>
  <k>1</k>
  <id>ISO_CODE</id>
  <n>ISO_CODE</n>
  <vis>1</vis>
  <value>CA</value>
  <dt>1</dt>
  <binding>UI="EditBox"</binding>
  </it>
<it>
  <k>2</k>
  <id>NAME</id>
  <n>NAME</n>
  <vis>1</vis>
  <value>Canada</value>
  <dt>1</dt>
  <binding>UI="EditBox"</binding>
  </it>
  </args>
  </openArgs>
  </meta>
  </SetDbCommandResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetDbCommand" :
{
"tDbCommand" :
{
"id" : "S1!M!S!M2"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"text" : "true",
"openArgs" : "true"
},
"meta" :
{
"type" : "Command",
"text" :
{
"sqlText" : "Insert Into T_COUNTRY (ISO_CODE, NAME) values (:ISO_CODE, :NAME)"
},
"openArgs" :
{
"args" :
{
"it" :
[
{
"k" : "4294967295",
"id" : "ISO_CODE",
"n" : "ISO_CODE",
"vis" : "true",
"value" : "CA",
"dt" : "1"
},
{
"k" : "4294967295",
"id" : "NAME",
"n" : "NAME",
"vis" : "true",
"value" : "Canada",
"dt" : "1"
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"text" : "true",
"openArgs" : "true"
}
}
}
}

JSON response:

{
"SetDbCommandResult" :
{
"id" :
{
"id" : "S1!M!S!M2"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "OBJ9054",
"n" : "DBMS command",
"k" : "9054",
"c" : "3841",
"p" : "9050",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"type" : "Command",
"text" :
{
"its" :
{
"it" :
[
{
"driverID" : "ORCL8",
"driverName" : "Oracle",
"sqlText" : ""
},
{
"driverID" : "MSSQL",
"driverName" : "Microsoft SQL Server 6.x\7.x\2000",
"sqlText" : ""
},
{
"driverID" : "MSSQL2005",
"driverName" : "Microsoft SQL Server 2005",
"sqlText" : ""
},
{
"driverID" : "MSSQL2008",
"driverName" : "Microsoft SQL Server 2008",
"sqlText" : ""
},
{
"driverID" : "MSSQL2012",
"driverName" : "Microsoft SQL Server 2012\2014\2016",
"sqlText" : ""
},
{
"driverID" : "MSSQL2012ODBC",
"driverName" : "Microsoft SQL Server (ODBC)",
"sqlText" : ""
},
{
"driverID" : "ODBC",
"driverName" : "Generic ODBC",
"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" : "Greenplum\/Pivotal HD Hawq",
"sqlText" : ""
},
{
"driverID" : "POSTGRES",
"driverName" : "PostgreSQL",
"sqlText" : ""
},
{
"driverID" : "SQLITE",
"driverName" : "SQLite",
"sqlText" : ""
},
{
"driverID" : "WSF",
"driverName" : "WEB Service",
"sqlText" : ""
},
{
"driverID" : "VERTICA",
"driverName" : "Vertica",
"sqlText" : ""
}
]
},
"sqlText" : "Insert Into T_COUNTRY (ISO_CODE, NAME) values (:ISO_CODE, :NAME)"
},
"openArgs" :
{
"args" :
{
"it" :
[
{
"k" : "1",
"id" : "ISO_CODE",
"n" : "ISO_CODE",
"vis" : "1",
"value" : "CA",
"dt" : "1",
"binding" : "UI="EditBox""
},
{
"k" : "2",
"id" : "NAME",
"n" : "NAME",
"vis" : "1",
"value" : "Canada",
"dt" : "1",
"binding" : "UI="EditBox""
}
]
}
}
}
}
}
public static SetDbCommandResult ChangeSQLObjectParameters(DbCommandId moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetDbCommand()
{
tArg = new SetDbCommandArg()
{
pattern = new DbCommandMdPattern()
{
text = true,
openArgs = true
},
meta = new DbCommandMd()
{
type = DbCommandType.Command,
text = new DbCommandText()
{
sqlText = "Insert Into T_COUNTRY (ISO_CODE, NAME) values (:ISO_CODE, :NAME)"
},
openArgs = new OdOpenArgs
{
args = new OdArg[]
{
new OdArg
{
k = uint.MaxValue,
id = "ISO_CODE",
n = "ISO_CODE",
dt = 1, //DbDataType.String
vis = true,
value = "CA"
},
new OdArg
{
k = uint.MaxValue,
id = "NAME",
n = "NAME",
dt = 1, //DbDataType.String
vis = true,
value = "Canada"
}
}
}
},
metaGet = new DbCommandMdPattern()
{
text = true,
openArgs = true
}
},
tDbCommand = moniker
};
//Change parameters
var tResult = somClient.SetDbCommand(tSet);
return tResult;
}

See also:

SetDbCommand