B b4auser1 Well-Known Member Licensed User Longtime User Feb 22, 2016 #1 B4A: Code: Copy ExecQuery2 (QueryAsString, StringArgs() AsString) As android.database.Cursor B4i: Code: Copy ExecQuery2 (Query As String, Args As Object) As ResultSet B4J: Code: Copy ExecQuery2 (Query As String, Args As List) As ResultSet After SQL 1.3 android.database.Cursor casts to ResultSet, but StringArgs is still Code: Copy () As String and we have to have separate code resolved in common source with help of #If ... B4A: Code: Copy #If B4A sql1.ExecQuery2("SELECT col1 FROM table1 WHERE col3 = ?", Array As String(22)) #Else sql1.ExecQuery2("SELECT col1 FROM table1 WHERE col3 = ?", Array(22)) #End If I propose to make Args As Object in B4J, B4A for ExecQuery2, ExecNonQuery2, ExecQueryAsync, ExecQuerySingleResult2, ... It will provide back compatibility with existing code, and allow to eliminate #If ...
B4A: Code: Copy ExecQuery2 (QueryAsString, StringArgs() AsString) As android.database.Cursor B4i: Code: Copy ExecQuery2 (Query As String, Args As Object) As ResultSet B4J: Code: Copy ExecQuery2 (Query As String, Args As List) As ResultSet After SQL 1.3 android.database.Cursor casts to ResultSet, but StringArgs is still Code: Copy () As String and we have to have separate code resolved in common source with help of #If ... B4A: Code: Copy #If B4A sql1.ExecQuery2("SELECT col1 FROM table1 WHERE col3 = ?", Array As String(22)) #Else sql1.ExecQuery2("SELECT col1 FROM table1 WHERE col3 = ?", Array(22)) #End If I propose to make Args As Object in B4J, B4A for ExecQuery2, ExecNonQuery2, ExecQueryAsync, ExecQuerySingleResult2, ... It will provide back compatibility with existing code, and allow to eliminate #If ...
Erel B4X founder Staff member Licensed User Longtime User Feb 22, 2016 #2 There is no need to use conditional compilation here. The only difference is in ExecQuery and ExecQuery2. You can use Array As String on all three platforms. There is a technical reason for it being an array of strings in B4A. As it is a List in B4J and B4i (you wrote the signature incorrectly) it can handle an array of any type. See KeyValueStore2 for an example.
There is no need to use conditional compilation here. The only difference is in ExecQuery and ExecQuery2. You can use Array As String on all three platforms. There is a technical reason for it being an array of strings in B4A. As it is a List in B4J and B4i (you wrote the signature incorrectly) it can handle an array of any type. See KeyValueStore2 for an example.
B b4auser1 Well-Known Member Licensed User Longtime User Feb 22, 2016 #3 Erel said: you wrote the signature incorrectly Click to expand... There is a mistake in documentation: https://www.b4x.com/b4i/help/isql.html#sql_execquery2
Erel said: you wrote the signature incorrectly Click to expand... There is a mistake in documentation: https://www.b4x.com/b4i/help/isql.html#sql_execquery2