From: Warren Young Date: November 19 2007 7:25pm Subject: Re: How to insert binary data from an array of bytes List-Archive: http://lists.mysql.com/plusplus/7166 Message-Id: <4741E31C.4080304@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit António Santos wrote: > > I have an array of bytes (unsigned char[]) and I want to insert those > bytes into a table. I would first examine whether this is the best table design. Array-of-anything should almost always map to rows in a separate table, not a column containing N values. It's a one-to-many relationship, one of the main reasons databases can hold multiple tables. > The provided example doesn't help me that much > because it uses binary data read from a file. examples/load_jpeg.cpp doesn't insert a file into the database, it inserts a std::string into the database, and a std::string is just a fancy way to hold an array of characters. The fact that the string happens to be populated from a file in this case is incidental.