class PG::BasicTypeMapForQueries::BinaryData

conn.exec_params(“INSERT INTO test (data) VALUES ($1)”, [bd])
bd = PG::BasicTypeMapForQueries::BinaryData.new(“abxff0cd”)
conn.exec(“CREATE TEMP TABLE test (data bytea)”)
conn.type_map_for_queries = PG::BasicTypeMapForQueries.new(conn)
with binary encoding.
Please note however that PG::BasicTypeMapForResults delivers bytea columns as plain String
That way they’re distinct from text strings.
it’s necessary to send binary strings as BinaryData.
Since PG::BasicTypeMapForQueries chooses the encoder to be used by the class of the submitted value,
Helper class for submission of binary strings into bytea columns.