We can not say more as you are not providing enough informations/you posted incomplete code.
Well, we could say something about this code:
1 Dim l As List : l.Initialize
2 Dim query1 As String
3 l.Add("SELECT SIZE")
4 For i=0 To l.Size -1
5 l.Add(l.Get(i))
6 Next
Line 1 creates an empty list. No complaint so far.
Line 2 we can ignore, other than wondering why it is located here, and not closer to where it is actually used.
Line 3 adds "SELECT SIZE" to the list, thus the list is now 1 item long.
Line 4 translates to "For i= 0 to 0", which will do one loop through the next line.
Line 5 translates to "l.Add(l.Get(0))", which will add another copy of the first and only item currently in the list ("SELECT SIZE") thus the list is now 2 items long (and both are "SELECT SIZE"...
to be sure, to be sure?)
Line 6 should terminate the loop, because in line 4 we said to only do the loop once (from 0 to 0)
Even if B4A used the revised loop upper limit, which changed from 0 to 1 when we added the second item to the list, that would mean the loop would then run to infinity (but not beyond!) because each time we added another item to the list, the terminating value of the loop would be incremented just out of our reach again. I'm guessing this is not happening.
So, at the point where you
log(l) you should be seeing two items in the list, and in the bit where you are accessing
l.Get(5) apparently there are still only two items in the list.
I can't actually see where the
l.Get(5) is occurring in your supplied code, but it's late here and I'm tired so presumably my brain is starting to shut down for the day.
