You are right. Since populateSQL is called within a while-loop
I have to put transaction and commit outside of the loop.
Damn monday mornings... Thanks a lot.