WL#148: Foreign keys: Implement Foreign Keys (all storage engines)

Affects: Server-6.1   —   Status: Assigned

Foreign Keys  
------------  
  
MySQL currently "supports" foreign keys in two ways:  
(1) if storage engine = InnoDB then let InnoDB handle them,  
(2) otherwise parse and ignore foreign-key clauses.  
The goals of this task are:
- make foreign-key support possible for any storage
  engine (which could handle it) via a combination of API
  calls and server handling.
- support SQL standard syntax instead of InnoDB syntax.  
  
I use the abbreviation FK when discussing the child / referencing 
table (the table with the foreign key), or its indexes and columns.  
I use the abbreviation PK when discussing the parent / referenced  
table (which is often a table with a primary key), or its  
indexes and columns.

Note that this implementation is for immediately-checked
constraints only. Deferred constraints -- i.e. constraints
that are checked at transaction-end rather than statement-end
are another task and will be implemented for all constraint
types (not just foreign key constraints) when the time comes.