WL#1821: Don't create .frm files for temporary tables

Affects: Server-7.0   —   Status: On-Hold

Now we always create a .frm file when the user excutes CREATE TEMPORARY TABLE.
For most table types this is not needed and just slows down temporary table 
creaation, as we now create the .frm file and then open it to be able to open 
the temporary file.

It also makes it harder to do some functions, like automaticly convert heap 
tables to myisam tables.

The do this we have to change how table createion and table opening is done
to change how table creation is done.

Some of the changes that needs to be done:
- ha_create_table() should take a TABLE *object as as argument and not open the 
.  frm file.
- We need a function to create a .frm file from a TABLE *object:
  create_frm(TABLE* table)
- mysql_create_frm() should probably first create a TABLE object and then call 
create_frm()
- When need a function to open a handler based on a TABLE object.

First stage should be to analyze more of the code to decide what other new 
functions needs to be created and what old functions need to be changed.

Note by Guilhem Bichot 2007-07-11
As mentioned in WL#934, PeterG suggests our user-visible temporary tables
survive a shutdown/restart, and this is backed by Oracle's behaviour (the
definition of a table created with "create global temporary table txxx (s1 int)"
does survive a shutdown/restart). So, in the future, temporary tables may need
to have a FRM so that their definition can survive shutdown/restart. Thus, this
task may apply only to species of temporary tables which don't survive
shutdown/restart, if there are in the future.
now the process of table creation (temporary or persistent) starts with
the creation of frm file.
Then TABLE instance is created based on the frm file.
As temporary table is never reopened, we just can skip frm creation for it,
but then we need new table creation function based not on frm file, but
on 'in-memory' data.
So the plan is:
to implement
  mysql_create_table_instance function, to fill TABLE structure
     with the CREATE arguments. TABLE structure is alloced as
     in open_table function
  create_frm function to create frm file for given TABLE

then
rea_create_table() should be modified to work that way:
    t= mysql_create_table_instance(); // creates TABLE object from the CREATE 
                                      // arguments
    if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
    {
        open_temporary_table(t);  // attach table to the temporary table list
    }
    else
    {
        create_frm(t);  // creates frm file for the persistent table
        my_hash_insert(&open_cache, t); // add to the 'openedtables' list
    }


ha_create_table() should take TABLE* as an argument, it supposed to be
called from mysql_create_table_instance