Hi guys,
In a non UI database, I have a codes like these
When datatabase connection errors happen, Query, ResultSet & Transaction will not closed properly, how to handle it? Or B4J automatically delete unclosed Query,ResultSet & Transaction when next execution occurred? What happen to unfinished transaction? Will it rollback automatically?
In a non UI database, I have a codes like these
B4X:
Sub Process_Globals
Private pool As ConnectionPool
Private Tm As Timer
End Sub
Sub AppStart (Args() As String)
pool.Initialize(....)
Tm.Initialize("TM",3000)
Tm.Enabled = True
Try
StartMessageLoop
Catch
Log("main error")
End Try
End Sub
Sub TM_Tick
Private RS As ResultSet
Private Qry,ExecQ As SQL
Tm.Enabled = False
Log("==========================================")
Try
Qry = pool.GetConnection
RS = Qry.ExecQuery("SELECT * FROM table where id = -9")
ExecQ.BeginTransaction
do while RS.NextRow
'do some operations
loop
RS.Close
Qry.Close
ExecQ.TransactionSuccessful
Catch
Log("unable to connect!")
End Try
Tm.Enabled = True
End Sub
When datatabase connection errors happen, Query, ResultSet & Transaction will not closed properly, how to handle it? Or B4J automatically delete unclosed Query,ResultSet & Transaction when next execution occurred? What happen to unfinished transaction? Will it rollback automatically?