Android Question jrdc2 executeQuery .vs. executeBatch


Licensed User
ExecuteQuery: A single query statement (SELECT). Only one pre-defined (configured on the server) SELECT statement can be sent to the jRDC2 server at a time. No exceptions.

ExecuteBatch: 1 or more pre-defined non-query statements (INSERT, UPDATE, DELETE) can be sent to the jRDC2 server. If, for example, you have 100 INSERT statements, you can create all 100 statements and then sent them all at once to the jRDC2 server.

Look here: The GetRecord method can only sent one "select_animal" command to the jRDC2 server at once to retrieve an animal. The InsertRecord, on the other hand, could be rewritten as:
Sub InsertRecords (Names() As String)
   Dim cmdList as List
   For Each Name as String in Names
      Dim cmd as DBCommand = CreateCommand("insert_animal", Array(Name, Null))
   Dim j As HttpJob = CreateRequest.ExecuteBatch(cmdList, Null)
   Wait For(j) JobDone(j As HttpJob)
   If j.Success Then
       Log("Inserted successfully!")
   End If
End Sub
As you can see, only one ExecuteBatch is called for all the insert commands created.
Upvote 0