WL#5812: Add server interfaces for functionality used by replication

Affects: Server-Prototype Only   —   Status: Assigned

This is a step towards making replication a library, such that the 5.6 rpl-lib 
can be plugged into the 5.5 core [WL#5675].

In this worklog, we add interfaces to core for all functionality that rpl-lib 
needs.

This is a top-WL. In this WL, we list the members of classes defined by core and 
used by rpl-lib. We will create several sub-WLs that handles each member (or group 
of members) individually.

We can resolve each member in three possible ways:
 - refactor rpl-lib so that we do not need to access the field
 - in core, add a wrapper for the field (if the field belongs to core)
 - move the field to THD::thd_rpl (if the field belongs to rpl-lib)
All lists here are incomplete and will be extended as we find new classes and 
members.

The following classes/structs are used by rpl-lib:
  THD
  LEX
  MYSQL_LOCK
  Protocol
  TABLE
  SELECT_LEX_UNIT

The following members are used by rpl-lib:

==== class THD ====
lex

db
set_db()
db_charset
db_length
reset_db()
catalog

protocol

killed
killed_errno()
is_error()
stmt_da->sql_errno()
stmt_da->reset_diagnostics_area()
stmt_da->message()
is_slave_error
clear_error()
is_fatal_error
stmt_da->is_error()

system_thread
slave_thread
thread_specifi_used
thread_id
pseudo_thread_id
thread_stack

rand_used
rand_saved_seed1
rand_saved_seed2
rand.seed1
rand.seed2

set_query()
set_query_and_id()
query()
query_length()
reset_query()
reset_query_inner()
set_query_id()
init_for_queries()

in_multi_stmt_transaction_mode()
transaction.all.modified_non_trans_table
transaction.stmt.modified_non_trans_table
transaction.stmt.ha_list
transaction.all.ha_list

current_linfo
binlog_evt_union.*
locked_tables_mode
user_var_events
enter_cond
exit_cond
spcont
lock
extra_lock
warning_info->warn_list()
server_id
start_time
need_binlog_invoker()
has_invoker()
get_invoker_user()
get_invoker_host()
set_invoker()
security_ctx
time_zone_used
tx_isolation
set_time()
update_charset()
update_server_status()
enable_slow_log
one_shot_set
temporary_tables
warning_info->opt_clear_warning_info()
strmake()
alloc()
net.vio
net.pkt_nr
cuted_fields
stmt_da->can_overwrite_status
mdl_context.release_transactional_locks()
mdl_context.release_statement_locks()
mem_root
force_one_auto_inc_interval()
field_id
slave_net
user_vars
packet
net
stmt_da
proc_info
get_command()
LOCK_thd_data
awake()
real_id
security_ctx->skip_grants()
client_capabilities
store_globals()
cleanup()
clear_active_vio()
set_active_vio()

variables.sql_mode
variables.net_wait_timeout
variables.auto_increment_increment
variables.auto_increment_offset
variables.lc_time_names_number
variables.collation_database
variables.character_set_client
variables.collation_connection
variables.collation_server
variables.time_zone
variables.completion_type
variables.lock_wait_timeout
variables.option_bits
variables.binlog_format
variables.binlog_direct_non_trans_update
variables.max_allowed_packet
variables.binlog_row_image

==== struct LEX ====
ident.str
ident.length
sql_command
mi
unit
current_select
requires_replocking()
stmt_accessed_non_trans_temp_table()
thd
drop_temporary
select_lex.item_list.elements
select_lex.context.resolve_in_table_list_only()
create_info.optoins
is_mixed_stmt_unsafe()
local_file
duplicates
set_stmt_row_injection()
query_tables