Android Question [SOLVED] - Check my version of jRDC2

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Dear colleagues

Every now and then I make changes to the SQL queries that jRDC2 runs.

I have set the current version and date of the last changes I made in jRDC2 to be displayed when the test is run (Please see image)


Is there a way to check this version and date in B4A?

As always, I am very grateful.
 
Last edited:

aeric

Expert
Licensed User
Longtime User
I think you can add new commands in LoadSQLCommands sub.
B4X:
Private Sub LoadSQLCommands(config As Map)
    Dim newCommands As Map
    newCommands.Initialize
    For Each k As String In config.Keys
        If k.StartsWith("sql.") Then
            newCommands.Put(k, config.Get(k))
        End If
    Next
    commands = newCommands
    commands.Put("sql.current_version", $"SELECT ${Main.VERSION} AS 'Current Version'"$)
    commands.Put("sql.current_date", $"SELECT '${DateTime.Date(DateTime.Now)}' AS 'Current Date'"$)
End Sub
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Thank you very much @aeric

What was done was in jRDC2 in B4J to change the LoadCommands procedure in the RDCConnector module

B4X:
Private Sub LoadSQLCommands(config As Map)
    Dim newCommands As Map
    newCommands.Initialize
    For Each k As String In config.Keys
        If k.StartsWith("sql.") Then
            newCommands.Put(k, config.Get(k))
        End If
    Next
    commands = newCommands
    commands.Put("sql.current_version", $"SELECT ${Main.VerActual} AS 'Version'"$)
End Sub


In B4A simply consult with this code

B4X:
Sub VersionTest() As ResumableSub
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("current_version",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(result As DBResult)
        If j.JobName = "DBRequest" Then
            Dim result As DBResult = req.HandleJob(j)
            If result.Rows.Size>0 Then
                For Each records() As Object In result.Rows
                    Dim Version As Long  = records(result.Columns.Get("Version"))
                    ToastMessageShow("Version-->"&Version,True)
                Next
            End If
            
        End If
    End If
    Dim res As DBResult = Null
    Return res
End Sub


You can now consult perfectly from B4A, I am very grateful.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…