I am using the following code to get jRDC2 data from MySQL DB.
This works great (Thanks @Erel)
The Log is:
Is it possible to call a new "DBCommand" from within the above code and Wait before moving onto the new row().
For instance:
B4X:
Sub GetNotSent
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("select_notsent", Array())
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
'work with result
req.PrintTable(res)
For Each row() As Object In res.Rows
MyID = row(res.Columns.Get("id"))
MyCity = row(res.Columns.Get("city"))
MyProduct1 = row(res.Columns.Get("product1"))
Log("ID: " & MyID)
Log("City: " & MyCity)
Log("Product: " & MyProduct1)
'NOW Call another Query here for each row and wait before moving to next row()
Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub
The Log is:
B4X:
Waiting for debugger to connect...
Program started.
Tag: null, Columns: 3, Rows: 3
id city product1
35 Centurion Life Policy
36 Centurion Life Policy
37 Centurion Life Policy
ID: 35
City: Centurion
Product: Life Policy
ID: 36
City: Centurion
Product: Life Policy
ID: 37
City: Centurion
Product: Life Policy
For instance:
B4X:
ID: 35
City: Centurion
Product: Life Policy
WAIT AND CALL NEW QUERY AND ACTION NEW QUERY / THEN MOVE TO NEXT ROW() IF ANY
ID: 36
City: Centurion
Product: Life Policy
WAIT AND CALL NEW QUERY AND ACTION NEW QUERY / THEN MOVE TO NEXT ROW() IF ANY
ID: 37
City: Centurion
Product: Life Policy
WAIT AND CALL NEW QUERY AND ACTION NEW QUERY / THEN MOVE TO NEXT ROW() IF ANY