Sub Process_Globals
Private Pool1 As ConnectionPool
Private Pool2 As ConnectionPool
Private Tm As Timer
Private Qry1,Qry2,ExecQ1,ExecQ2 as SQL
end Sub
Sub AppStart (Args() As String)
Pool1.Initialize(...)
Pool2.Initialize(...)
Qry1 = Pool1.GetConnection
Qry2 = Pool2.GetConnection
ExecQ1 = Pool1.GetConnection
ExecQ2 = Pool2.GetConnection
Tm.Initialize("TM",3000)
Tm.Enabled = True
StartMessageLoop
End Sub
Sub TM_Tick
TM.Enabled = False
Private RS As ResultSet
RS = Qry1.ExecQuery("select * from table where log = 0 order by id")
Try
ExecQ1.BeginTransaction
ExecQ2.BeginTransaction
Do While RS.NextRow
'do some operations'
Loop
ExecQ1.TransactionSuccessful
ExecQ2.TransactionSuccessful
Catch
ExecQ1.Rollback
ExecQ2.Rollback
End Try
RS.Close
TM.Enabled = True
End Sub