1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question jrdc2 executeQuery .vs. executeBatch

Discussion in 'Android Questions' started by manuelsalazar, Aug 29, 2019.

  1. manuelsalazar

    manuelsalazar Member Licensed User

    Hi :

    can anyone explain difference bewteen ExecuteQuery .vs. ExecuteBatch in JRDC2 ????


    thanks in Advanced.
    Manuel Salazar
     
  2. OliverA

    OliverA Expert 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: https://www.b4x.com/android/forum/t...ation-of-rdc-remote-database-connector.61801/. 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:
    Code:
    Sub InsertRecords (Names() As String)
       
    Dim cmdList as List
       cmdList.Initialize
       
    For Each Name as String in Names
          
    Dim cmd as DBCommand = CreateCommand("insert_animal"Array(Name, Null))
          cmdList.Add(cmd)
       
    Next
       
    Dim j As HttpJob = CreateRequest.ExecuteBatch(cmdList, Null)
       
    Wait For(j) JobDone(j As HttpJob)
       
    If j.Success Then
           
    Log("Inserted successfully!")
       
    End If
       j.Release
    End Sub
    As you can see, only one ExecuteBatch is called for all the insert commands created.
     
  3. yfleury

    yfleury Active Member Licensed User

    I can say ExecuteBatch is very fast
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice