title: How to insert binary data into a PostgreSQL BYTEA column using the C++ libpqxx API?
body: <p>I'd like to insert some binary data into a BYTEA column, but I find the Doxygen output is lacking in details, and <a href="http://pqxx.org/" rel="noreferrer">http://pqxx.org/</a> has been down for the past few days.</p>
  
  <p>How would I go about inserting the contents of somefile.bin into a table with a BYTEA column?</p>
  
  <p>What I have is along these lines:</p>
  
  <pre><code>pqxx::work work( conn );
  work.exec( "CREATE TABLE test ( name varchar(20), data BYTEA )" );
  work.exec( "INSERT INTO test( name, data ) VALUES ( 'foo', &lt;insert filename.bin here&gt; )" );
  work.commit();
  </code></pre>
  
  <p>If it makes a difference, I'd like to use the new <code>hex</code> format for BYTEA available in PostgreSQL 9.1.</p>