Wish B4x: ExecQuery2, ExecNonQuery2, ExecQueryAsync Args As Object

b4auser1

Well-Known Member
Licensed User
Longtime User
B4A:
B4X:
ExecQuery2 (QueryAsString, StringArgs() AsString) As android.database.Cursor

B4i:
B4X:
ExecQuery2 (Query As String, Args As Object) As ResultSet

B4J:
B4X:
ExecQuery2 (Query As String, Args As List) As ResultSet

After SQL 1.3 android.database.Cursor casts to ResultSet, but StringArgs is still
B4X:
() As String
and we have to have separate code resolved in common source with help of #If ...

B4A:
B4X:
#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
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.
 
Top