SQL: Asynchronous NonQuery Transaction Routine

Mahares

Expert
Licensed User
Longtime User
I presume a transaction routine is still beneficial in an asynch. non-query. Is the placement I have introduced below correct?
B4X:
'SQL1.BeginTransaction
'Try
  For i = 1 To 10000
        sql1.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array As Object(Rnd(0, 100000)))
  Next
  sql1.ExecNonQueryBatch("SQL")
  'SQL1.TransactionSuccessful
'Catch
      'Log(LastException.Message)
'End Try
'SQL1.EndTransaction

EDIT: According to Erel, no need for transaction routine as the command creates its own transaction. It will not help speed up the process. So, I remarked the lines shown above.
 
Last edited:

mc73

Well-Known Member
Licensed User
Longtime User
I don't know the structure of the asynchronous routine, but I would suppose it has already a begin/end transaction built-in, since we're talking about batch process. I find your question very useful!
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Thanks my friend mc73. I have a feeling it is needed. It will be interesting to see if Erel has tested with and without and what he thinks.
 
Upvote 0
Top