I find that the .nextrow function works totally fine in debug mode but it doesnt at a release mode. Here is the codes I extract and the erros in the logs:
Here is what caught in the log:
Note that the error doesnt occur in a debug mode, it only shows up in a release mode. Anyone knows why?
B4X:
Sub SelectEach(vFilter As String, vCallBack As String,tag As Object)
Dim SenderFilter As Object = sql1.ExecQueryAsync("SelectQuery", vFilter , Null)
Wait For (SenderFilter) SelectQuery_QueryComplete (success As Boolean, rs As JdbcResultSet)
If success Then
Read.LastUpdate_Record( GetTableFromFilter(Filter) )
Dim results As List = RS2List(rs,Module,vCallBack,tag)
CallSubDelayed3(Module,"SQL_Selected", results.size,tag )
Else
FailMsg
Log(LastException)
CallSubDelayed3(Module,"SQL_Selected", -1,tag )
End If
End Sub
Private Sub RS2List(RS As JdbcResultSet, vModule As Object, vCallback As String, tag As String) As List
Log("RS2List")
Dim results As List: results.initialize
Log("First Column Name = " & RS.GetColumnName(0))
Do While RS.NextRow
Log("NextRow: Results.size = " & results.size)
Dim m As Map = RS2map(RS)
Log(m)
results.Add(m)
If vModule <> Null Then CallSubDelayed3(vModule,vCallback,m,tag)
Loop
RS.Close
Log("RS2List Result = " & results)
Return results
End Sub
Here is what caught in the log:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
number of views = 0
(BALayout): Left=0, Top=0, Width=800, Height=1180
(BALayout): Left=0, Top=0, Width=800, Height=1180
Mainpanel=pfalse
Select Each: SELECT * , ( SELECT 報告 from 活動記錄 WHERE ID = ( SELECT MAX (ID) from 活動記錄 WHERE 活動記錄.電話號碼 = '0' AND 活動記錄.電話號碼 Is Not Null AND 活動記錄.活動 = 活動.ID)) As 報告 , ( SELECT 確認時間 from 活動記錄 WHERE ID = ( SELECT MAX (ID) from 活動記錄 WHERE 活動記錄.電話號碼 = '0' AND 活動記錄.電話號碼 Is Not Null AND 活動記錄.活動 = 活動.ID)) As 確認時間 , ( SELECT 取消時間 from 活動記錄 WHERE ID = ( SELECT MAX (ID) from 活動記錄 WHERE 活動記錄.電話號碼 = '0' AND 活動記錄.電話號碼 Is Not Null AND 活動記錄.活動 = 活動.ID)) As 取消時間 , ( SELECT 出席時間 from 活動記錄 WHERE ID = ( SELECT MAX (ID) from 活動記錄 WHERE 活動記錄.電話號碼 = '0' AND 活動記錄.電話號碼 Is Not Null AND 活動記錄.活動 = 活動.ID)) As 出席時間 , ( SELECT MAX (ID) from 活動記錄 WHERE 活動記錄.電話號碼 = '0' AND 活動記錄.電話號碼 Is Not Null AND 活動記錄.活動 = 活動.ID) As 活動記錄 , ( SELECT MAX (申請時間) from 活動記錄 WHERE 活動記錄.ID = ( SELECT MAX (ID) from 活動記錄 WHERE 活動記錄.電話號碼 = '0' AND 活動記錄.電話號碼 Is Not Null AND 活動記錄.活動 = 活動.ID) AND 活動記錄.活動 = 活動.ID And 取消時間 Is Null ) As 報名時間 , ( SELECT MAX (申請時間) from 活動記錄 WHERE 活動記錄.ID = ( SELECT MAX (ID) from 活動記錄 WHERE 活動記錄.電話號碼 = '0' AND 活動記錄.電話號碼 Is Not Null AND 活動記錄.活動 = 活動.ID) AND 活動記錄.活動 = 活動.ID ) As 申請時間 , ( SELECT MAX (關注時間) from 活動關注 WHERE 用戶 = '0' AND 活動關注.活動 = 活動.ID AND 取消時間 Is Null) As 關注時間 , ( SELECT COUNT (DISTINCT 電話號碼) from 活動記錄 WHERE 活動.ID = 活動記錄.活動 AND 確認時間 Is Null AND 取消時間 Is Null) As 待確認 , (( SELECT ID from 用戶 WHERE 用戶.電話號碼 = 活動.電話號碼 ) ) As 用戶 , (SELECT 顯示名稱 from 用戶 WHERE ID = 活動.導師) As 導師名稱 , (截止時間) As 截止日期 , ( 開始時間 + (長度_小時 * 3600000)) As 結束時間 , ( ( [開始時間] )) As 日期 , (名額 - (( SELECT COUNT (DISTINCT 電話號碼) from 活動記錄 WHERE 活動.ID = 活動記錄.活動 AND ( 取消時間 Is Null OR 取消時間 <= 0) ))) As 尚餘名額 , ( SELECT COUNT (DISTINCT ID) from 活動記錄 WHERE 活動.ID = 活動記錄.活動 AND ( 取消時間 Is Null Or 取消時間 = 0) AND 確認時間 Is Not Null) As 學生人數 , (( SELECT COUNT (ID) from 活動記錄 WHERE 活動.ID = 活動記錄.活動 And 活動記錄.出席時間 >= 開始時間 )) As 出席人數 , (( SELECT COUNT (DISTINCT 電話號碼) from 活動記錄 WHERE 活動.ID = 活動記錄.活動 AND ( 取消時間 Is Null OR 取消時間 <= 0) )) As 報名人數 , (( SELECT COUNT (用戶) from 活動關注 WHERE 活動.ID = 活動關注.活動 AND 取消時間 Is Null ) + (( SELECT COUNT (DISTINCT 電話號碼) from 活動記錄 WHERE 活動.ID = 活動記錄.活動 AND ( 取消時間 Is Null OR 取消時間 <= 0) )) ) As 關注人數 FROM 活動 WHERE 截止時間 >= 1583594876671 OR 名額 = 0 ORDER BY 開始時間
RS2List
First Column Name = ID
b4a_sql_vvvvvvvvvvvvvvvvvvvvvvvvv7 (java line: 2523)
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:249)
at libcore.io.IoBridge.recvfrom(IoBridge.java:553)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)
at libcore.io.Streams.readFully(Streams.java:81)
at java.io.DataInputStream.readFully(DataInputStream.java:99)
at java.io.DataInputStream.readFully(DataInputStream.java:95)
at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:850)
at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:731)
at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477)
at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:146)
at net.sourceforge.jtds.jdbc.ResponseStream$TdsInputStream.read(ResponseStream.java:518)
Note that the error doesnt occur in a debug mode, it only shows up in a release mode. Anyone knows why?