Hello,
I have a SQL adapter which executes Stored Procedures against a SQL database. However I need it to return the SQL return code, which I want to use to determine whether the SP call has been successful or not? Is there a way to get the SQLCode back? I thought there was some kind of %SQLCODE property I could get back? Something like set pResponse.ResultCode = ..Adapter.%Connection.%SQLCODE?
Class pacPICTSLib.SQL.opeSQL Extends Ens.BusinessOperation [ ProcedureBlock ]
{
Parameter ADAPTER = "EnsLib.SQL.OutboundAdapter";
Parameter INVOCATION = "Queue";
Method OnMessage(pRequest As reqSQL, Output pResponse As resSQL) As %Status
{
set pResponse = ##Class(pacMARTS.resSQLMessage).%New()
set pResponse.SQLRequest = pRequest
//Now execute the SQL
Set tSC = ..Adapter.ExecuteUpdate(.intRowAffected,pRequest.SQLScript)
set pResponse.RowsAffected = intRowAffected
set pResponse.Result = tSC
if $$$ISERR(tSC) {
set ..Retry=1
$$$LOGERROR("Error: "_tSC)
} else {
$$$TRACE("All OK")
}
Quit tSC
}
XData MessageMap
{
<MapItems>
<MapItem MessageType="pacPICTSLib.SQL.reqSQL">
<Method>OnMessage</Method>
</MapItem>
</MapItems>
}
}