I've been trying to calculate my packet size without success. I'm using MySQL at the moment and it seems to give me wierd results.
Code: Select all
...nevermind.... better example belowEDIT: Here's a better demonstration:
Code: Select all
$a = mysql_connect('localhost','root','****');
mysql_select_db('test',$a);
//mysql_query('SET @@global.max_allowed_packet=1024;');
$r = mysql_query('SELECT @@global.max_allowed_packet AS mpsize;',$a);
$f = mysql_fetch_assoc($r);
echo $f['mpsize'].'<br>';
$data = str_repeat('A',1024*15); // making some data
$query = "INSERT INTO `dbtest` (`test2`) VALUES ('$data');";
echo strlen($query).'<br>';
mysql_query($query) or die(mysql_error());So I managed to put 15403 bytes into a packet that has a max size of 1024 bytes1024
15403
EDIT2: With 1024*16, it does not work:
EDIT3: Solved!1024
16427
MySQL server has gone away