In B4XMainPage I have this code:
In a code module called Enums I have the this type:
If I run GetSQL_ExtraFromTable from B4XMainPage then I get this error:
java.lang.RuntimeException: java.lang.ClassNotFoundException: b4a.exampleljjll.b4xmainpage$_tsql_extra
at the line marked above.
If I declare the type in B4XMainPage, Sub Class_Globals then GetSQL_ExtraFromTable runs fine.
Other types declared in the code module Enums are recognized fine by Subs in B4XMainPage and I thought that Types declared in code modules should
be recognized by all the modules in a project, so why is this particular case different?
RBS
B4X:
Sub Class_Globals
Private ser As B4XSerializator
End Sub
Sub GetSQL_ExtraFromTable(strNameOfSQL As String, _
iFolderID As Int, _
strRunSQL As String) As tSQL_Extra
Dim strSQL As String
Dim RS1 As ResultSet
Dim arrBytes() As Byte
Dim tSE As tSQL_Extra 'this type is in the code module Enums
If strRunSQL.Length > 0 Then
strSQL = "select sql_extra from run_sql where sql = ? and length(sql_extra) > 0"
RS1 = cConn.SQLNon_Clinical.ExecQuery2(strSQL, Array As String(strRunSQL))
Else
strSQL = "select sql_extra from saved_sql where name = ? and folder_id = ? and length(sql_extra) > 0"
RS1 = cConn.SQLNon_Clinical.ExecQuery2(strSQL, Array As String(strNameOfSQL, iFolderID))
End If
'Log("GetSQL_ExtraFromTable, RS1.RowCount: " & RS1.RowCount)
If RS1.RowCount = 0 Then
Return tSE 'return un-initialized type
End If
RS1.Position = 0
arrBytes = RS1.GetBlob2(0)
'Log("GetSQL_ExtraFromTable, arrBytes.Length: " & arrBytes.Length)
tSE.Initialize
tSE = ser.ConvertBytesToObject(arrBytes) '<<<<< java.lang.RuntimeException: java.lang.ClassNotFoundException: b4a.exampleljjll.b4xmainpage$_tsql_extra
RS1.Close
Return tSE
End Sub
In a code module called Enums I have the this type:
B4X:
Type tSQL_Extra(strData_Types As String, _
bChartDataTypes As Boolean, _
strChart_Title As String, _
strChartLine_Names As String, _
strSQLForDate_Line1 As String, _
strSQLForDate_Line2 As String, _
strColumnWidths As String, _
bRun_Chart As Boolean, _
bGraphXProportional As Boolean, _
bChartTitleInPatLabel As Boolean, _
bActive As Boolean, _
strSQL As String, _
strSQLName As String)
If I run GetSQL_ExtraFromTable from B4XMainPage then I get this error:
java.lang.RuntimeException: java.lang.ClassNotFoundException: b4a.exampleljjll.b4xmainpage$_tsql_extra
at the line marked above.
If I declare the type in B4XMainPage, Sub Class_Globals then GetSQL_ExtraFromTable runs fine.
Other types declared in the code module Enums are recognized fine by Subs in B4XMainPage and I thought that Types declared in code modules should
be recognized by all the modules in a project, so why is this particular case different?
RBS