I am trying to upload an icon from a client to a server and then to other clients over tcp/ip. the icon data will be stored in mysql on the server. the column is defined as a mediumblob field. once on the server, i escape the string and then put it into a mysql statement to insert it into the database, but only 10 or so of the 15000 characters are put in. code looks like this -

stringstream query;
char *iconNotMySQL=(char*)malloc(icon.length()); // icon is a c++ stl string of the icons data
char *iconMySQL=(char*)malloc((icon.length() * 2) + 1);
memcpy(iconNotMySQL, icon.c_str(), icon.length());


mysql_real_escape_string(&mysql, iconMySQL, iconNotMySQL, icon.length());

    query << "UPDATE members SET email = \"" << email << "\", "
          << "location = \"" << loc << "\", "
          << "bio = \"" << bio << "\", "
          << "showemail = \"" << showemail << "\", "
          << "icon = \"" << iconMySQL << "\" "
          << "WHERE username = \"" << name << "\"";
    MaGmysql_query(query.str());

when I check the length of query.str() it looks exactly as it should, but not all the data is inserted into the database. can anyone help me out?

thanks
chris

Reply via email to