changed remaining db functions to use parameterized strings. Added sql TRIM user defined function.