anchor.diff:              {error, Reason, P}
       end.
   
  -recv_until_eof(Protocol, Func, Args, List) ->
  +recv_until_eof(Func, Args, List, Protocol) ->
       case recv(Protocol, 1) of
           {ok, <<255>>, #protocol{}=P} ->
               recv_error(P);
   	{ok, <<254>>, #protocol{}=P} ->
  -            recv_eof(P, lists:reverse(List));
  +            recv_eof(lists:reverse(List), P);
           {ok, Byte, #protocol{}=P} ->
  -            recv_until_eof(P, Func, Args, List, Byte);
  -        {error, Reason, P} ->
  -            {error, Reason, P}
  -    end.
  -
  -recv_until_eof(Protocol, Func, Args, List, Byte) ->
  +            recv_until_eof(Func, Args, List, Byte, P);
  +        {error, Reason, P} ->
  +            {error, Reason, P}
  +    end.
  +
  +recv_until_eof(Func, Args, List, Byte, Protocol) ->
       case apply(Func, [Protocol|[Byte|Args]]) of
           {ok, Term, #protocol{}=P} ->
  -            recv_until_eof(P, Func, Args, [Term|List]);
  -        {error, Reason, P} ->
  -            {error, Reason, P}
  -    end.
  -
  -send(#protocol{handle=H,compress=Z}=P, Binary) ->
  +            recv_until_eof(Func, Args, [Term|List], P);
  +        {error, Reason, P} ->
  +            {error, Reason, P}
  +    end.
  +
  +send(Binary, #protocol{handle=H,compress=Z}=P) ->
       case myer_network:send(H, Binary, Z) of
   	{ok, Handle} ->
   	    {ok, [], replace(P,Handle)};
  
positive.code:         <<L>> -> {L, Start+1, Length-1}
      end.
  
  recv_packed_integer(Protocol, undefined) ->
      case recv(Protocol, 1) of
          {ok, Byte, #protocol{}=P} ->
              recv_packed_integer(P, Byte);
          {error, Reason, P} ->
              {error, Reason, P}
      end;
  recv_packed_integer(Protocol, <<254>>) -> recv_unsigned(Protocol, 8);
  recv_packed_integer(Protocol, <<253>>) -> recv_unsigned(Protocol, 3);
  recv_packed_integer(Protocol, <<252>>) -> recv_unsigned(Protocol, 2);
  recv_packed_integer(Protocol, <<251>>) -> {ok, null, Protocol};
  recv_packed_integer(Protocol, <<Int>>) -> {ok, Int, Protocol}.
  
  %% -----------------------------------------------------------------------------
  %% << sql-common/client.c : send_client_reply_packet/3
  %% -----------------------------------------------------------------------------
  auth_to_binary(#protocol{maxlength=M,seed=S,caps=C,charset=E,plugin=P},
                 User, Password, Database)
    when ?ISSET(C,?CLIENT_PROTOCOL_41) ->
      X = myer_auth:scramble(Password, S, P),
      B = if ?ISSET(C,?CLIENT_SECURE_CONNECTION) -> N = size(X), <<N,X/binary>>;
  
negative.code: 
  %% -- private: loop,stmt_prepare --
  
  stmt_prepare_pre(Query, Protocol) ->
      {ok, [<<?COM_STMT_PREPARE,Query/binary>>], reset(Protocol)}.
  
  stmt_prepare_post(<<0>>, Protocol) ->
      case recv_rest(Protocol) of
  	{ok, Binary, #protocol{version=V}=P} ->
              stmt_prepare_recv_params(binary_to_prepare(V,Binary), P);
          {error, Reason, P} ->
              {error, Reason, P}
      end.
  
  stmt_prepare_recv_params(#prepare{param_count=0}=X, Protocol) ->
      stmt_prepare_recv_fields(undefined, X#prepare{params = []}, Protocol);
  stmt_prepare_recv_params(#prepare{param_count=N}=X, Protocol) ->
      case recv_until_eof(func_recv_field(Protocol), [], [], Protocol) of
          {ok, Result, Params, #protocol{}=P} when N == length(Params)->
              stmt_prepare_recv_fields(Result, X#prepare{params = Params}, P);
          {error, Reason, P} ->
              {error, Reason, P}
      end.
  
  stmt_prepare_recv_fields(Result, #prepare{field_count=0}=X, Protocol) ->
      {ok, X#prepare{result = Result}, Protocol};
  stmt_prepare_recv_fields(_Result, #prepare{field_count=N}=X, Protocol) ->
      case recv_until_eof(func_recv_field(Protocol), [], [], Protocol) of
          {ok, Result, Fields, #protocol{}=P} when N == length(Fields) ->
              {ok, X#prepare{fields = Fields, result = Result}, P};
          {error, Reason, P} ->
  