[#2212] [#2222] CID37583:

changed SQLExecDirect to take the string length instead of the
null-terminated string keyword because coverity suggested SQLExecDirect
may not handle that well. minor refactor of the surrounding function.