'Executes the query and returns a List of Maps with the column names as the keys
'The keys are lower cased.
'Returns an uninitialized list if no results found.
Sub ExecuteMapList(SQL As SQL, Query As String, StringArgs() As String, Limit As Int) As List ' ******* RVP Added
Dim rs As ResultSet = SQL.ExecQuery2(Query, StringArgs)
Log("ExecuteMapList: " & Query)
Dim TableList As List
Dim count As Int = 0
Do While rs.NextRow
If TableList.IsInitialized = False Then TableList.Initialize
count = count+1
If count <= Limit Or Limit = 0 Then
Dim res As Map
res.Initialize
Dim values(rs.ColumnCount) As String
For col = 0 To rs.ColumnCount - 1
Try
res.Put(rs.GetColumnName(col).ToLowerCase, rs.GetString2(col))
Catch
Dim byt() As Byte: byt = rs.GetBlob2(col)
res.Put(rs.GetColumnName(col).ToLowerCase, BytesToString(byt,0,byt.Length,"UTF8"))
End Try
Next
TableList.Add(res)
End If
Loop
rs.Close
Return TableList
End Sub