First attempt at using RDC2 and testing with a simple example. I'm running the jRDC v2.1. It connects to my backend mariadb okay, seems to execute my sql statement (I just setup a simple "select * from table"). I can print the column names to log in the jRDC, so I know it's iterating through them properly, however in the client side (which is also B4J) the result.columns in my JobDone event is null. I do get back the result.rows and I can iterate over those. I'm wondering why the columns is coming back null? I believe I'm using the correct versions of the modules. I'm using DBRequestManagerResumableSubs.zip from here (The DBRequestManager.bas doesn't seem to work in B4J as it references a BitMap and I don't think there is such an object type in B4J - I think it's Image). Any event I'm using the ResumableSubs version.
The only thing I can think of is that something funky is happening in HandleJob. I'm simply just testing out dumping the result of a query to log before incorprating into my project. It might be worth mentioning that I am using the B4RSerializator in this project as well (I don't think there should be a conflict b/w the B4XSerializator but I thought I'd mention it).
I am also running everything in release mode (I do have two instances of B4J up, one for my client and the other for jRDC).
Thoughts?
My simple client code is below:
The only thing I can think of is that something funky is happening in HandleJob. I'm simply just testing out dumping the result of a query to log before incorprating into my project. It might be worth mentioning that I am using the B4RSerializator in this project as well (I don't think there should be a conflict b/w the B4XSerializator but I thought I'd mention it).
I am also running everything in release mode (I do have two instances of B4J up, one for my client and the other for jRDC).
Thoughts?
My simple client code is below:
B4X:
Sub Process_Globals
Private reqManager As DBRequestManager
Type DBResult (Tag As Object, columns As Map, Rows As List)
Type DBCommand (Name As String, Parameters() As Object)
End Sub
Sub AppStart (Form1 As Form, Args() As String)
'test
reqManager.Initialize(Me, "http://localhost:17178/rdc")
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_ir"
reqManager.ExecuteQuery(cmd, 0, Null)
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
Log("Error: " & Job.ErrorMessage)
Else
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
'work with result
Log(result.Rows.Size) 'returns correct number of rows
If result.columns = Null Then 'always null - why?
Log("Columns is null")
Return
End If
Dim sb As StringBuilder
sb.Initialize
For Each col In result.Columns.Keys
sb.Append(col).Append(TAB)
Next
Log(sb.ToString)
For Each row() As Object In result.Rows
Dim sb As StringBuilder
sb.Initialize
For Each record As Object In row
sb.Append(record).Append(TAB)
Next
Log(sb.ToString)
Next
End If
End If
Job.Release
End Sub