iOS Question [B4X] DBRequestManager - getting different results with B4i than B4A/B4J


Well-Known Member
Licensed User
Longtime User
EDIT: I solved this by changing ColNames(X) = Col to ColNames(Res.Columns.Get(Col)) = Col.
But I still feel something must be wrong given that the data returned by each program is in such a radically different format.

I am feeling a little gun shy about posting so many of my posts lately seem to have been stupid mistakes on my part or a lack of understanding .. BUT here we go again.

I am using DBRequestManager.bas

I am running the exact same code in A/J/i
The relevant code:
    'SELECT Emp_Num, Emp_FirstName, Emp_LastName, Emp_AllowEdits, Emp_Rate, Emp_AllowMulti FROM Employees WHERE (Emp_Inactive=0);
    Dim req As DBRequestManager = CreateRequest
    Dim cmd1 As DBCommand = CreateCommand("GetEmployees", Null)
    Wait For (req.ExecuteQuery(cmd1, 0, "GetEmployees")) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        If res.Rows.Size > 0 Then
            EMPs = req.DBResultToMap(res)
Sub DBResultToMap(Res As DBResult) As List
    Dim ColNames(Res.Columns.Size) As String, X As Int
    For Each Col In Res.Columns.Keys
        ColNames(X) = Col
        X = X + 1

    Dim Rows As List, X As Int, Y As Int
    For Each Row() As Object In Res.Rows
        X = 0
        Dim Cols As Map
        Y = 0
        For Each Fld As String In Row
            Cols.Put(ColNames(Y), Fld)
            Y = Y + 1
    Return Rows
End Sub
The problem is this: in B4i the fields are returned in a different order plus size gets added as a bonus field. The data does not. So when my little routine to put stuff in a map is done everything is in the wrong field in B4i. DBResultToMap is meant to be generic so regardless of the data passed it should return a map with everything in the right fields.



res looks completely different in B4i compared toB4j (and I am assuming B4A, I didn't check B4A but it works)


What silly mistake am I making this time? Or do I need to handle B4i data differently?

Thanks in advance for your help.


Well-Known Member
Licensed User
Longtime User
You are keep making claims that are plainly wrong.
I cannot help you like this. Sorry.
I was not implying that there is something wrong with B4x. I was trying to say that I feel like, once again, I am looking at something the wrong way.
Upvote 0