tags:

views:

20

answers:

0

Hello,

I'm created table with one MEDIUMBLOB column and writing every second 2 images (16 or 32 KB) to this table. But random times i get Lost connection to MySQL server during query. Maybe i need to tune some mysqld server params or do something different ? I tested with local and remote mysqld server and i get same error.

My code to write blob:

  char *chunk = (char*)malloc(size*2+1) ; 
  mysql_real_escape_string(c, chunk, sendbuf, size);
  char *query = (char*) malloc(size*2+5000) ; 
  char *stat = "INSERT INTO images(filename,image,time,timeframe) VALUES('%s','%s',NOW(),'2001-01-19 03:14:07')" ; 
  int len = sprintf(query, stat, x, chunk, timeframe) ; 
  if (mysql_real_query(c, query, len))
  {
      printf("Error %u: %s\n", mysql_errno(c), mysql_error(c));
  }