WL#3914: Additonal accessors required to compile InnoDB as a plugin storage engine

Affects: Server-5.1   —   Status: Complete   —   Priority: Low

The InnoDB storage engine needs access to more MySQL internals than we want to
provide for general plugins.  This is for various historical reasons (to support
foreign keys, special handling of binary logging, etc.).

In order to compile InnoDB as a plugin (without having MYSQL_SERVER defined),
some extra accessors are required.
Additional accessors for MySQL internals, which are publicly available to plugins:
  - Full definition of MYSQL_LEX_STRING (identical to LEX_STRING from
  - Full definition of MYSQL_XID (binary compatible with XID from
  - mysql_tmpfile(), creates a temporary file in mysqld's tmpdir
  - thd_killed(), to check killed state of connection
  - thd_alloc() and similar allocation functions
  - thd_get_xid(), to get XID of connection's transaction
  - mysql_query_cache_invalidate4(), to invalidate a table's query
    cache entries

Additional InnoDB-specific accessors, which are defined inside #ifdef
INNODB_COMPATIBILITY_HOOKS and declared in ha_innodb.h:

  - thd_charset()
  - thd_query()
  - thd_slave_thread()
  - thd_non_transactional_update()
  - thd_binlog_format()

Because InnoDB has specific requirements which don't apply to other storage
engines (foreign keys, etc.), it requires access to more MySQL internals than we
want to expose to all plugins.  If it is determined in the future that general
plugins do need access to this, it is easy to move these accessors to plugin.h
so they're available.
An initial discussion of this can be found here


Further refinement has been handled off the public lists; see this thread: