Android Question [Solved] How do I make a Transaction in jRDC2?

Sergio Castellari

Active Member
Licensed User
Situation:
1) Currently I perform Insert, Update and delete of individual queries with no problems
2) I need to make a transaction with the following queries:

config.properties:
sql.insert_cab_RC=Insert into CABRC (NRO,LEYENDA,NOMCLIE,CODCLIE,FECHA,FECHA2,HORA,USUARIO,IMPORTE,PROCESO,ANTICIPO,RESTANTE,DGI) value (?,?,?,?,?,?,?,?,?,?,?,?,?)
sql.insert_cob_EFE=Insert into CAJA_MOVI (CODCAJA,DESCAJA,CAMBIO,DISPO,INGRESO,EGRESO,DETALLE,FECHA,HORA,USUARIO,PROCESO,SUCU,DGI) value (?,?,?,?,?,0.0,?,?,?,?,?,?,?)
sql.insert_cuerpo_RC_efe=Insert into CUERC (NRO,TIPO,DETALLE,FECHAEMI,IMPORTE,ENTRAPOR,PROCESO,NOMCONTA) value (?,?,?,?,?,?,?,?)
sql.insert_cob_CHE=Insert into CHEQTER (NROCHEQ,CODBANCO,BANCO,IMPORTE,FECHAEMI,FECHAVTO,FECHADEP,ENTRAPOR,SALEPOR,ESTADO,CAJAENTRA, \
                   CAJASALE,OPER,EXTERNO,NROCAJA,DGI,INGRESADO) value (?,?,?,?,?,?,"0000-00-00",?,"","E",?,"0",?,"N","0",?,?)
sql.insert_cuerpo_RC_che=Insert into CUERC (NRO,TIPO,DETALLE,FECHAEMI,FECHAVTO,IMPORTE,COMP,ENTRAPOR,PROCESO,NOMCONTA) value (?,?,?,?,?,?,?,?,?,?)

I don't realize how I can transact with all these inquiries.
I've been searching the forum, but I can't find any code examples where you can see how it works.
I know that jRDC2 has the ability to do it.

Currently I run an operation as follows:

B4X:
 nProceso = nProceso + 1
            Dim aCom() As String
            aCom = Array As String(nProceso)
            Dim cmd As DBCommand = CreateCommand("update_proceso", aCom)
            Dim j As HttpJob = Main.jConex.CreateRequest.ExecuteBatch(Array(cmd), Null)
            Wait For(j) JobDone(j As HttpJob)
            If j.Success Then
                Log("Actualiza New PROCESO OK !!!")
                Return nProceso
            Else
                Log("Actualiza New PROCESO FALLO !!!")
                Return 0
            End If
        Else
            MsgboxAsync(Respuesta.Get("Mensaje"),"")
            Return 0
        End If

In config.properties I have the following SQL statement:

B4X:
sql.update_proceso=Update PROCESO Set PROCESO=? Where IDPROCESO=1

Greetings
 

Sergio Castellari

Active Member
Licensed User
B4X:
Dim commands As List
commands.Initialize
Commands.Add(CreateCommand(...))
Commands.Add(CreateCommand(...))
Commands.Add(CreateCommand(...))

Dim j As HttpJob = Main.jConex.CreateRequest.ExecuteBatch(Commands, Null)
            Wait For(j) JobDone(j As HttpJob)
Thanks @Erel
Exactly I solved it "that" way.
Use this code:
https://www.b4x.com/android/forum/threads/jrdc2-add-mysql-master-detail.96897/
What did Mr. @ José J. Aguilar suggest to me
I was also surprised by the recording speed !!! .... really very fast!
Total hugs!
 
Upvote 0
Top