I need to store sql table structure. Using a map, with this declaration
B4X:
Sub Globals
Private Fields() As Map
Private Tables() As Map
End Sub
Fields = Array As Map (InitFields("ID",3),InitFields("DT",1),InitFields("FRM_N",1))
Tables = Array As Map(InitTables("MEM_FRM",Fields))
Or using Custom Type and array
B4X:
Sub Globals
Type Field(Nm As String,Typ As Byte)
Type Table(Nm As String,Field() As Field)
Private Fields() As Field
Private Tables() As Table
End Sub
Fields = Array As Field(InitFields("ID",3),InitFields("DT",1),InitFields("FRM_N",1))
Tables = Array As Table(InitTables("MEM_FRM",Fields))
Which one is easier to process, such as retrieve its value, delete, update, etc.
The variables should most probably be declared in Process_Globals.
It depends on your requirements. It is not clear from the code above what you plan to do with these data structures. As a general rule maps are more powerful and are easier to work with compared to lists (or arrays).
if you just fill a map with the right info you could do it like this
B4X:
Type user (name as string,age as int)
dim u as user
u=mUsers.get(userid) 'get specific user info based on its ID from a usermap
log(u.name &" "& u.age)