This is needed because ruby doesn't null terminate strings, but the PG
connection adapter does. Without this, trying to use a string containing
null in an hstore will always result in invalid SQL (Unexpected end of
I chose to truncate the string at the first \0 to be consistent with
quote_string and the native PQescapeStringConn.