WL#755: Write TABLE_TYPE, SQL_MODE etc to the binlog

Affects: Server-5.0   —   Status: Complete   —   Priority: Medium

Some variables affect how parsing and execution of updates are done. Example :
FOREIGN_KEY_CHECKS (this last one reported by user)
TABLE_TYPE (Monty is not sure if we should replicate it, for people
who use different handlers on master and slave)
BIG_TABLES ?? (not really needed, as starting from 4.0 this variable doesn't
change much the behaviour: query does not fail; we should leave the SQL slave
thd run with BIG_TABLES=0 that's the best general-purpose value).
(SQL_SELECT_LIMIT does NOT affect replication because it affects only true
SELECT, and not subqueries, not INSERT ... SELECT, not CREATE ... SELECT, not SPs).

These are probably most of the variables to care of.

The idea is using some bytes in the binlog event's header. We would
write the values of the variables for every event.
We already have 16 bits, only 3 are used ; Monty suggests we
extend 16->64 bits to have room. That's nice but means a change
of binlog format and we have to take care of backward compatibility
(5.0 master and 4.0/4.1 slave). Also 64 bits is great for bit
variables, but what about CHARACTER_SET ?

This task slightly overlaps 1063 and 1062.

As of 2007-06-25 Guilhem reports all is done in 5.0 except ENGINE 
(was called TABLE_TYPE).