Recent posts:
Recent replies:

Hi,

What you can do is a snapshot of this ResultSet.

Then use the global of this snapshot for another Operation :

Get snapshot global :

Method OnGetSnapshot(pRequest As Ens.Request, Output pResponse As Ens.StringResponse) As %Status
{
    set tStatus = $$$OK

    try{

        set pResponse = ##class(Ens.StringResponse).%New()

        set tQuery = "SELECT *  FROM [sqlserver].[dbo].[whatever] "

        //$$$TRACE(tQuery)      
        Set pSnap = ##class(EnsLib.SQL.Snapshot).%New()

        //size of snapshot
        // -1 = Max
        set pSnap.MaxRowsToGet = -1

        $$$ThrowOnError(..Adapter.ExecuteQueryBatch(pSnap,tQuery,1000))

        $$$ThrowOnError(pSnap.%Save())


        set pResponse.StringValue = pSnap.%GblRef   

    }
    catch exp
        {
            Set tStatus = exp.AsStatus()
        }
    Quit tStatus
}

Use snapshot global :

Method UseSnapshot(pRequest As Ens.StringRequest, Output pResponse As Ens.Response) As %Status
{

    set status = $$$OK

    try {
        set pResponse = ##class(Ens.Response).%New()

        set nRow = 0
        set tSequence = 0

        //Get SnapShot
        Set tSnap = ##class(EnsLib.SQL.Snapshot).%New()
        set tSnap.%GblRef = pRequest.StringValue // use of global SnapShot
        set tSnap.%CurrentRow = 0
        set tSnap.FirstRow = 1
        set tSnap.MaxRowsToGet = -1

        $$$TRACE("MaxRowsToGet :  "_tSnap.RowCountGet())

                while tSnap.Next() {
                    try {
                            set nRow = nRow + 1
                            set tSequence = tSequence + 1

                            set i = 0

                            set i = i + 1
                            set tParam(i) = tSnap.Get("Col1")


                            set i = i + 1
                            set tParam(i) = tSnap.Get("Col2")


                            set i = i + 1
                            set tParam(i) = tSnap.Get("Col3")


                            set i = i + 1
                            set tParam(i) = tSnap.Get("ColX")

                            set tParam = i

                            set tQuery = "UPDATE Whatever  "_
                                        "SET   "_
                                        "Col1 = ?  "_
                                        ",Col2 = ?  "_
                                        ",Col3 = ?  "_
                                        " WHERE ColX = ?  " 


                            $$$ThrowOnError(..Adapter.ExecuteUpdateParmArray(.tResult,tQuery,.tParam))

                        } catch exSnap {
                            // Update exeption
                        }

        }


    } catch ex {
        set status = ex.AsStatus()
    }
    return status
}

Furthermore, If you have big table to query/insert in JDBC consider this ZPM module :
https://github.com/grongierisc/BatchSqlOutboundAdapter

Hi Alexender, I'll send you the WSDL in PM.

But I guess I found a workaround :

I created a new method that parse the XML with %XML.Reader and correlate the payload with my destination class :

 set reader = ##class(%XML.Reader).%New()
 // pRequest.GetPatientsByClinicResult.any.GetAt(1) <-- Header
 // pRequest.GetPatientsByClinicResult.any.GetAt(2) <-- Payload
 do reader.OpenString(pRequest.GetPatientsByClinicResult.any.GetAt(2))
 do reader.Correlate("Patients","FME.Object.Patient")

 while reader.Next(.object,.status) {
   do pResponse.Patients.Insert(object)
 }

Where FME.Object.Patient is :

Class FME.Object.Patient Extends (%SerialObject, %XML.Adaptor)
{

Property LastName As %String;

Property FirstName As %String;

Property Datex0020ofx0020Birth As %String(XMLNAME = "Date_x0020_of_x0020_Birth");

Property Gender As %String;

Property Code As %String;

Property Insurance As %String;

Property GUID As %String;

Property CLINICGUID As %String;

}
Open Exchange applications:
Followers:
Guillaume has no followers yet.
Following:
Guillaume has not followed anybody yet.
Global Masters badges:
Guillaume has no Global Masters badges yet.