B4J Question Boolean Flag Wrong Behavior

pesquera

Active Member
Licensed User
Longtime User
Hi, on the following code I make an error for testing (see xxx)
B4X:
Public Sub BackupData(user As String) As Boolean
    Dim flagSuccess As Boolean=False
    lock.WriteLock
Try
    sql.ExecNonQuery2("DELETE FROM databackup WHERE user = ?", Array(user))
    sql.ExecNonQuery2("INSERT INTO databackup xxx SELECT * FROM data WHERE user = ?", Array(user))
    flagSuccess = True
Catch
    Log(LastException)
    'flagSuccess = False
End Try
    lock.WriteRelease
Log("flagSuccess="&flagSuccess)   
    Return flagSuccess
End Sub

So, the Catch logs the Exception.. but, flagSuccess is returned as True.. while I assigned False when Dimmed

If I uncomment this code -> 'flagSuccess = False
it does work fine

Could this be some bug?

Thanks
 

pesquera

Active Member
Licensed User
Longtime User
Hi Erel, no.. in release mode it doesn't
I've noticed now that on debug mode does not fail every time.. seems to be an intermitent issue
thanks for your help
 
Upvote 0
Top