Dear TadMan,
You are right! I moved the connect and disconnect out of the function and performance flies now. It was taking about 5 minutes to process 116 records before and now it's around ten seconds.
I found that it didn't like me using prepare_cached with the same database handle (it complained that "Data type for parameter 1 has changed since first SQLExecute call", so I'm using prepare instead. Still, performance is blazing now.
I'll see if I can create the library you speak of. Thanks a lot. -timallen