WL#7082: Move permanent transformations from JOIN::optimize () to JOIN::prepare ()

Status: Complete

GOAL: save CPU time, memory, avoid future "prepared statement" bugs, make code
simpler.

MEANS: Refactor how the optimizer does permanent transformations to queries
(semijoin, in-to-exists, outer-to-inner-join).

Pushed to 5.7 on March 3rd, 2014.

User Documentation
==================

No user documentation required.