Wish DButils ExecuteMaps

Sepehr_b

Member
Hi Erel,
the DBUtils.InsertMaps is a very usefull function and I was searching for the vice function to read from table to list of Maps, although there is a ExecuteToMemory which makes an array, but it can be a good idea to have a function to make a list of maps from database.

I made one for myself, but I prefer to use in internal functions in newer versions

My ExecuteMaps:
Public Sub ExecuteMaps(Sql As SQL,Query As String,StringArgs() As String,Limit As Int, PK As String) As List
    Dim lstFinal As List
    lstFinal.Initialize()
    Dim tmpList As List = DBUtils.ExecuteList(Sql,Query,StringArgs,Limit)
    For Each r In tmpList
        Dim m As Map = DBUtils.Executemap(Sql,$"SELECT * FROM (${Query}) as _tmp WHERE ${PK} = ${r}"$,StringArgs)
        lstFinal.Add(m)
    Next
    Return lstFinal   
End Sub
 
Top