List:MySQL++« Previous MessageNext Message »
From:sinoth Date:April 28 2010 2:07am
Subject:Insert BLOB from file without extra copy
View as plain text  
This may be more of a C++ question but hopefully one of you has run across
it.  As per the tutorial "Dealing with Binary Data", the correct way to load
a file and insert it as a BLOB seems to be to read it to a char* array, then
use std::string's assign function to copy the data.  From there you can
shove the string into the query using stream operators.  It bugs me that the
data has to be copied and exist in memory twice.

Is there any other way to insert BLOB data from a file without having to
copy it to a std::string?  I looked at std::stringstream, but even it's
str() function returns a copy of the data, which I'm trying to avoid.

Thread
Insert BLOB from file without extra copysinoth28 Apr
  • Re: Insert BLOB from file without extra copyme2228 Apr
    • Re: Insert BLOB from file without extra copysinoth28 Apr
  • Re: Insert BLOB from file without extra copyJonathan Wakely28 Apr
    • Re: Insert BLOB from file without extra copysinoth29 Apr