Hello!
I wrote the following sub:
- this sub is located in a code Module Common
If I add one of these rows, the compiler fails to compile successfully.
The error:
Please note that if I remove the .AddSingleLine2, then the error will be for GetString.
Is this a bug or I am doing things in a wrong way?
If it matters, here is the code for loadDBFiles()
SQL1, ExecNonQuery, ExecuteForReusult as located in a Code Module "SQLL", my LIST db field is "VARCHAR(100)".
According to my logs, the DB is initialized.
But, this is a compiling issue. Haven't noticed the compiler to refuse to compile because of logical errors.
Edit: The generated JAVA source code is :
I wrote the following sub:
- this sub is located in a code Module Common
B4X:
Sub loadToListView(theListView As ListView)
Dim result As Cursor
Dim i As Int
Dim clmList As String
result = loadDBFiles
' Adding the rows below makes the compiler break during Java compilation
For i = 0 To result.RowCount - 1
result.Position = i
clmList = result.GetString("LIST")
theListView.AddSingleLine2(clmList, 1)
Next i
' End of rows that the compiler refuses to compile
result.Close
End Sub
If I add one of these rows, the compiler fails to compile successfully.
B4X:
For i = 0 To result.RowCount - 1
result.Position = i
clmList = result.GetString("LIST")
theListView.AddSingleLine2(clmList, 1)
Next i
The error:
Compiling code. 0.23
Generating R file. 0.01
Compiling generated Java code. Error
B4A line: 346
theListView.AddSingleLine2(clmList, 1)
javac 1.6.0_23
src\com\1\2\common.java:841: not a statement
}_i;
^
Please note that if I remove the .AddSingleLine2, then the error will be for GetString.
Is this a bug or I am doing things in a wrong way?
If it matters, here is the code for loadDBFiles()
B4X:
Sub ExecuteForResult(query As String) As Cursor
Dim cursor1 As Cursor
Common.LogT("RESULT QUERY: " & query, "QUERY")
Try
cursor1 = SQL1.ExecQuery(query)
Catch
Common.LogT("BAD RESULT QUERY: " & query & " --- " & LastException, "QUERY")
End Try
Return cursor1
End Sub
SQL1, ExecNonQuery, ExecuteForReusult as located in a Code Module "SQLL", my LIST db field is "VARCHAR(100)".
According to my logs, the DB is initialized.
But, this is a compiling issue. Haven't noticed the compiler to refuse to compile because of logical errors.
Edit: The generated JAVA source code is :
B4X:
public static String _loadtolistview(anywheresoftware.b4a.BA _ba,anywheresoftware.b4a.objects.ListViewWrapper _thelistview) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _result = null;
int _i = 0;
String _clmlist = "";
//BA.debugLineNum = 328;BA.debugLine="Sub loadToListView(theListView As ListView)";
//BA.debugLineNum = 330;BA.debugLine="Dim result As Cursor";
_result = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
//BA.debugLineNum = 331;BA.debugLine="Dim i As Int";
_i = 0;
//BA.debugLineNum = 333;BA.debugLine="Dim clmList As String";
_clmlist = "";
//BA.debugLineNum = 336;BA.debugLine="result = loadDBFiles";
_result = _loaddbfiles(_ba);
//BA.debugLineNum = 340;BA.debugLine="For i = 0 To result.RowCount - 1";
{
final double step193 = 1;
final double limit193 = (int)(_result.getRowCount()-1);
for (_i = (int)(0); (step193 > 0 && _i <= limit193) || (step193 < 0 && _i >= limit193); _i += step193) {
//BA.debugLineNum = 342;BA.debugLine="result.Position = i";
_result.setPosition(_i);
//BA.debugLineNum = 344;BA.debugLine="clmList = result.GetString(\"LIST\")";
_clmlist = _result.GetString("LIST");
//BA.debugLineNum = 346;BA.debugLine="theListView.AddSingleLine2(clmList, 1)";
_thelistview.AddSingleLine2(_clmlist,(Object)(1));
}
}_i; // THIS IS common:841 ********************
//BA.debugLineNum = 352;BA.debugLine="result.Close";
_result.Close();
//BA.debugLineNum = 354;BA.debugLine="End Sub";
return "";
}
Last edited: