Android Question opposite DBUtil. insertMaps

FrankDev

Active Member
Licensed User
Hi

there is a function like in

DBUtil. insertmaps

that does exactly the opposite ?

This means that the query saves an SQL query in a list.
the individual entries of the list are in a map.
the single map consists of field name + value

regards Frank
 

davidvidasoft

Member
Licensed User
You are looking for the function called ´DBUtils.ExecuteJSON´. It returns a list inside a map with a key "root".

To extract the list you should do something like the following line:
B4X:
Dim list1 As List = DBUtils.ExecuteJSON(SQL, "...", Null, 0, Array As String(...)).Get("root")
 
Upvote 0

FrankDev

Active Member
Licensed User
I have the function
ExecuteList

already found. Only the whole thing doesn't work out like I expected.

if I use the Json function, I don't have an additional step because I have to run the result through the Json again to have a plain list.
 
Upvote 0

OliverA

Expert
Licensed User
if I use the Json function, I don't have an additional step because I have to run the result through the Json again to have a plain list.
Huh? If you are talking about @davidvidasoft's code, it returns a "plain" list of maps. Is this not what you were looking for? The name ExecuteJSON may be confusing you. The method is not returning JSON, but as is documented in the DBUtils code base, the method "executes the given query and creates a Map that you can pass to JSONGenerator and generate JSON text".
 
Upvote 0

FrankDev

Active Member
Licensed User
Hi

you're right, it's actually exactly the function I need.

The name of the function' ExecuteJSON' really confused me.
Then the list is packed into a map and returned.

Do you really need the type list (Text, Integer, Real)?
I've always wrapped all Types in a string.
The entry in the list is almost always a string.

Real and Intger are converted correctly.
I have now tried this with about 3000 records.
The result was always correct.
 
Upvote 0
Top