Fix clang build under mavericks (OSX 10.9)
Fix, sanitize, and tidy the logic around return codes in rlm_sql