# class PG::BasicTypeMapForQueries::BinaryData

Helper class for submission of binary strings into bytea columns.

Since `PG::BasicTypeMapForQueries` chooses the encoder to be used by the class of the submitted value, it’s necessary to send binary strings as `BinaryData`. That way they’re distinct from text strings. Please note however that `PG::BasicTypeMapForResults` delivers bytea columns as plain String with binary encoding.

    conn.type_map_for_queries = PG::BasicTypeMapForQueries.new(conn)
    conn.exec("CREATE TEMP TABLE test (data bytea)")
    bd = PG::BasicTypeMapForQueries::BinaryData.new("ab\xff\0cd")
    conn.exec_params("INSERT INTO test (data) VALUES ($1)", [bd])