log (some) sql errors. refs #1
clean a bit.
typedefs for C string types (unsigned char* and char*).