WL#1986: Embedded library: don't set up parameter types on each execution of prepared statement

Affects: Server-4.1   —   Status: Un-Assigned   —   Priority: Medium

A part of execution of prepared statement is setting up of appropriate
conversion functions, which unpack data of given
type from network buffer and assign it to the parameter.
In case of SQL syntax for prepared statement parameter data is obtained from
In case of embedded library parameters data is obtained directly
from MYSQL_BIND buffers created from client API.
Current implementation of this functionality for embedded library needs to be
implemented in a more efficient and tidy manner.
- types of parameters can be set up only once, when they've been changed, but
not on each execution of prepared statement.
- embedded library specific functionality should be pulled out of
  assign-all-parameters cycle, which (cycle) is not embedded-library specific. 
That is, embedded/SQL syntax/conventional specific functionality can be moved to
a class, like (the version below stands
for conventional mode; it's assumed that appropriate implementations of given
interface exist for SQL syntax and embedded

struct Param_data_source
  inline Param_data_source(uchar **data_arg, uchar *data_end_arg);

  inline bool setup_one_conversion_function();

  uchar **data;
  uchar *read_pos;
  uchar *data_end;

Param_data_source::Param_data_source(uchar **data_arg, uchar *data_end_arg) :
inline bool
Param_data_source::setup_one_conversion_function(Item_param *it)
  ushort typecode;
  static const uint signed_bit= 1 << 15;

  if (read_pos >= data_end)

  typecode= sint2korr(read_pos);
  read_pos+= 2;
  it->unsigned_flag= test(typecode & signed_bit);
  setup_one_conversion_function(it, (uchar) (typecode & ~signed_bit));