I know this is not a proper bug report, but actually I have no clues and isolating the code in a sample project is a lot of work, so I might just ask if someone had similar issues and might have a clue on what's going on.
The same code works fine on B4A and B4J
On B4i, the same query, repeated with no other code in between, gives different results
Here is the resumable sub that reads a table from DB, and fills a list with the results
Now the code that calls the above sub
In the log I find:
entries 3
entries 76
entries 3
usually I find one of those cases:
1) all 3 entries numbers are the same (that is what is expected)
2) 1 or 2 numbers are different and the order of the "wrong ones" may differ at each run
The same code works fine on B4A and B4J
On B4i, the same query, repeated with no other code in between, gives different results
Here is the resumable sub that reads a table from DB, and fills a list with the results
B4X:
Public Sub Read(day As Long, location As String) As ResumableSub
Dim entries As List
entries.Initialize
Try
Dim SenderFilter As Object = DB.ExecQueryAsync("SQL", "SELECT timestamp,provider,forecast,mint,maxt FROM meteo WHERE day=? AND location=?", Array As String(day, location))
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet)
If Success Then
Do While rs.NextRow
Dim m As MeteoEntry = Meteo.CreateMeteoEntry( _
rs.GetLong("timestamp"), _
rs.GetString("provider"), _
day, _
rs.GetString("forecast"), _
rs.GetInt("mint"), _
rs.GetInt("maxt") _
)
entries.Add(m)
Loop
rs.Close
Else
WriteLog("error reading")
End If
Catch
ExceptionHandler.Manage("MeteoDB.Read", ExceptionHandler.EXCEPTION_CRITICAL)
End Try
Return entries
End Sub
Now the code that calls the above sub
B4X:
Wait For (Globals.database.Read(forecastday, location)) Complete (entries As List)
WriteLog($"entries ${entries.Size}"$)
Wait For (Globals.database.Read(forecastday, location)) Complete (entries1 As List)
WriteLog($"entries ${entries1.Size}"$)
Wait For (Globals.database.Read(forecastday, location)) Complete (entries2 As List)
WriteLog($"entries ${entries2.Size}"$)
In the log I find:
entries 3
entries 76
entries 3
usually I find one of those cases:
1) all 3 entries numbers are the same (that is what is expected)
2) 1 or 2 numbers are different and the order of the "wrong ones" may differ at each run