Hi,
I'm having problems inserting binary data into MySQL using C. Here's a simple example to illustrate what I'm trying to do:
int intArray[4];
intArray[0] = 0;
intArray[1] = 1;
intArray[2] = 3;
intArray[3] = 4;
char* byteArray(new char[sizeof(intArray)]);
memcpy(byteArray, intArray, sizeof(intArray));
sprintf(query,"INSERT INTO blobTable VALUES('%s')\n", byteArray);
mysql_real_query (itsDBConnection, query, strlen(query));
When I run the above code, the query executes but the BLOB field is empty. I pinted out the query string and it reads: INSERT INTO blobTable VALUES('')
Any ideas? Thanks!