The answers to two of our SQL problems are in the original post. I can't quite understand why you'd need to create a dll, but hey, if it works. Andreas is right. As I said to Paul, we can't predict or debug the errors so can't put any evidence into a case.
Without the time to test every single line of our code, we've more or less given up on PB 12.6; it's basically not usable for any purpose.
It is the only PowerBuilder runtime I've encountered in 23 years that crashes randomly. The IDE yes, runtime never.* All of which leaves us on an unsupported version and no prospect of a usable supported version in sight. Thanks SAP, another lost customer. Not that you care. Apparently there are still some people in SAP working on PowerBuilder. What are they doing? Doesn't look like they're doing any fixes for the mess they've created.
Paul
*maybe PB7 had a few bodgy bits. Too old, tired, and sick of the whole sorry mess to try and remember.