Hi all
i am trying to send a loop of queries to the server (using JRDC2) but it seems that each query replaces the previous one.
If i run the code in debug mode (pausing on each line) it executes ok, so i think that i let the answers comes back from the server before sending the next query
This is the code
1) the loop that send the queries
2) the sub that send each query
I guess that i am missing something about resumable subs ...
thanks!
i am trying to send a loop of queries to the server (using JRDC2) but it seems that each query replaces the previous one.
If i run the code in debug mode (pausing on each line) it executes ok, so i think that i let the answers comes back from the server before sending the next query
This is the code
1) the loop that send the queries
B4X:
For i=0 To lst.Size-1
wait For (CheckT(lst.Get(i))) complete (mresult As Map)
If mresult.Get("ReqOK")=True Then
....
Return
End If
Next
2) the sub that send each query
B4X:
Sub CheckT(P As String)As ResumableSub
Dim m As Map
m.Initialize
m.Put("ConnOk",False)
m.Put("ReqOK", False)
Dim Req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("QueryName",Array(P))
Wait For (Req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
m.Put("ConnOk",True)
Req.HandleJobAsync(j, "req")
Wait For (Req) req_Result(res As DBResult)
'Req.PrintTable(res)
If res.Rows.Size>0 Then
Dim record() As Object=res.Rows.Get(0)
If record(res.Columns.Get("cTAG"))=0 Then
m.Put("ReqOK", True)
End If
End If
Else
Log("ERROR: " & j.ErrorMessage)
Msgbox(j.ErrorMessage,"Error")
End If
j.Release
Return m
End Sub
I guess that i am missing something about resumable subs ...
thanks!