anchor.diff:              {error, Reason, Handle}
       end.
   
  -recv_binary(Term, _Caps, #handle{}=H) ->
  -    myer_handle:recv_binary(H, Term).
  -
  -recv_text(Term, _Caps, #handle{}=H) ->
  -    myer_handle:recv_text(H, Term).
  +recv(#handle{}=H) -> % < loop
  +    case recv_binary(1, H) of
  +        {ok, <<0>>, Handle} ->
  +            recv_result(Handle);
  +        {ok, <<255>>, Handle} ->
  +            recv_reason(Handle)
  +    end.
  +
  +recv_binary(Length, Handle) ->
  +    myer_handle:recv_binary(Handle, Length).
  +
  +recv_text(Pattern, Handle) ->
  +    myer_handle:recv_text(Handle, Pattern).
   
   recv_fields_func(Caps) % TODO
     when ?IS_SET(Caps,?CLIENT_PROTOCOL_41) ->
  -    fun myer_protocol_text_old:recv_field_41/3;
  +    fun myer_protocol_text_old:recv_field_41/2;
   recv_fields_func(_Caps) ->
  -    fun myer_protocol_text_old:recv_field/3.
  -
  -recv_fields_length(Byte, Caps, #handle{}=H) ->
  -    case recv_packed_unsigned(Byte, Caps, H) of
  +    fun myer_protocol_text_old:recv_field/2.
  +
  +recv_fields_length(Byte, #handle{}=H) ->
  +    case recv_packed_unsigned(Byte, H) of
           {ok, U, Handle} ->
               {ok, [U,Handle]}
       end.
   
  -recv_fields_length(Byte, Term, Caps, #handle{}=H) ->
  -    case recv_packed_unsigned(Byte, Caps, H) of
  +recv_fields_length(Byte, Term, #handle{}=H) ->
  +    case recv_packed_unsigned(Byte, H) of
           {ok, U, Handle} ->
               {ok, [U,Term,Handle]}
       end.
   
   recv_fields(U, #handle{caps=C}=H) -> % < loop
  -    case recv_until_eof(recv_fields_func(C), [], [], C, H) of
  +    case recv_until_eof(recv_fields_func(C), [], [], H) of
           {ok, [_Result,Fields,Handle]} when U == length(Fields) ->
               {ok, [Fields,Handle]}
       end.
   
  -recv_packed_binary(Byte, Caps, #handle{}=H) ->
  -    case recv_packed_unsigned(Byte, Caps, H) of
  +recv_packed_binary(Byte, #handle{}=H) ->
  +    case recv_packed_unsigned(Byte, H) of
           {ok, null, Handle} ->
               {ok, null, Handle};
           {ok, 0, Handle} ->
               {ok, <<>>, Handle};
           {ok, Length, Handle} ->
  -            recv_binary(Length, Caps, Handle)
  -    end.
  -
  -recv_packed_unsigned(Caps, #handle{}=H) ->
  -    case recv_binary(1, Caps, H) of
  +            recv_binary(Length, Handle)
  +    end.
  +
  +recv_packed_unsigned(#handle{}=H) ->
  +    case recv_binary(1, H) of
           {ok, Byte, Handle} ->
  -            recv_packed_unsigned(Byte, Caps, Handle)
  -    end.
  -
  -recv_packed_unsigned(undefined, Caps, Handle) -> recv_packed_unsigned(Caps, Handle);
  -recv_packed_unsigned(<<254>>,   Caps, Handle) -> recv_unsigned(8, Caps, Handle);
  -recv_packed_unsigned(<<253>>,   Caps, Handle) -> recv_unsigned(3, Caps, Handle);
  -recv_packed_unsigned(<<252>>,   Caps, Handle) -> recv_unsigned(2, Caps, Handle);
  -recv_packed_unsigned(<<251>>,  _Caps, Handle) -> {ok, null, Handle};
  -recv_packed_unsigned(<<Int>>,  _Caps, Handle) -> {ok, Int, Handle}.
  -
  -recv_remains(Byte, Caps, #handle{}=H) ->
  -    case recv_binary(remains(H), Caps, H) of
  +            recv_packed_unsigned(Byte, Handle)
  +    end.
  +
  +recv_packed_unsigned(undefined, Handle) -> recv_packed_unsigned(Handle);
  +recv_packed_unsigned(<<254>>,   Handle) -> recv_unsigned(8, Handle);
  +recv_packed_unsigned(<<253>>,   Handle) -> recv_unsigned(3, Handle);
  +recv_packed_unsigned(<<252>>,   Handle) -> recv_unsigned(2, Handle);
  +recv_packed_unsigned(<<251>>,   Handle) -> {ok, null, Handle};
  +recv_packed_unsigned(<<Int>>,   Handle) -> {ok, Int, Handle}.
  +
  +recv_remains(Byte, #handle{}=H) ->
  +    case recv_binary(remains(H), H) of
           {ok, Binary, Handle} ->
               {ok, [<<Byte/binary,Binary/binary>>,Handle]}
       end.
   
  -recv_result(#handle{caps=C}=H) -> % < loop
  -    case recv_binary(1, C, H) of
  -        {ok, <<0>>, Handle} ->
  -            recv_result(#result{}, C, Handle);
  -        {ok, <<255>>, Handle} ->
  -            recv_reason(#reason{}, C, Handle)
  -    end.
  -
  -recv_rows(Fields, #handle{caps=C}=H) -> % < loop
  -    case recv_until_eof(fun myer_protocol_text:recv_row/4, [Fields], [], C, H) of
  +recv_rows(Fields, #handle{}=H) -> % < loop
  +    case recv_until_eof(fun myer_protocol_text:recv_row/3, [Fields], [], H) of
           {ok, [_Result,Rows,Handle]} ->
               {ok, [Fields,Rows,Handle]}
       end.
  
positive.code: stmt_prepare_pre(#handle{}=H, Query) ->
      {ok, [<<?COM_STMT_PREPARE,Query/binary>>,reset(H)]}.
  
  stmt_prepare_post(#handle{caps=C}=H) ->
      case recv_binary(1, C, H) of
          {ok, <<0>>, Handle} ->
              recv_prepare(#prepare{flags = ?CURSOR_TYPE_NO_CURSOR,
                                    prefetch_rows = 1, execute = 0}, C, Handle); % TODO
          {ok, <<255>>, Handle} ->
              recv_reason(#reason{}, C, Handle)
      end.
  
  stmt_prepare_recv_params(#prepare{param_count=0}=P, #handle{}=H) ->
      {ok, [P#prepare{params = [], result = undefined},H]};
  stmt_prepare_recv_params(#prepare{param_count=N}=P, #handle{caps=C}=H) ->
      case recv_until_eof(recv_fields_func(C), [], [], C, H) of
          {ok, [Result,Params,Handle]} when N == length(Params)->
              {ok, [P#prepare{params = Params, result = Result},Handle]}
      end.
  
negative.code: %% << sql/sql_acl.cc (< 5.7)         : send_server_handshake_packet/3
  %%    sql/auth/sql_authentication.cc : send_server_handshake_packet/3
  %% -----------------------------------------------------------------------------
  recv_handshake(MaxLength, Handle) ->
      recv_handshake(#handshake{
                        maxlength = MaxLength
                       }, myer_handle:caps(Handle), Handle).
  
  recv_handshake(#handshake{version=undefined}=R, Caps, Handle) ->
      {ok, B, H} = recv_text(<<0>>, Handle),
      recv_handshake(R#handshake{version = binary_to_version(B)}, Caps, H);
  recv_handshake(#handshake{tid=undefined}=R, Caps, Handle) ->
      {ok, U, H} = recv_unsigned(4, Handle),
      recv_handshake(R#handshake{tid = U}, Caps, H);
  recv_handshake(#handshake{seed1=undefined}=R, Caps, Handle) ->
      {ok, B, H} = recv_text(<<0>>, Handle),
      recv_handshake(R#handshake{seed1 = B}, Caps, H);
  recv_handshake(#handshake{caps1=undefined}=R, Caps, Handle) ->
      {ok, U, H} = recv_unsigned(2, Handle),
      recv_handshake(R#handshake{caps1 = U}, Caps, H);
  recv_handshake(#handshake{charset=undefined}=R, Caps, Handle) ->
      {ok, U, H} = recv_unsigned(1, Handle),
      recv_handshake(R#handshake{charset = U}, Caps, H);
  recv_handshake(#handshake{status=undefined}=R, Caps, Handle) ->
      {ok, U, H} = recv_unsigned(2, Handle),
      recv_handshake(R#handshake{status = U}, Caps, H);
  recv_handshake(#handshake{version=V,caps1=C,caps2=undefined}=R, Caps, Handle)
    when V >= [4,1,1]; ?IS_SET(C,?CLIENT_PROTOCOL_41) ->
      {ok, U, H} = recv_unsigned(2, Handle),
      recv_handshake(R#handshake{caps2 = U}, Caps, H);
  recv_handshake(#handshake{caps2=undefined}=R, Caps, Handle) ->
      recv_handshake(R#handshake{caps2 = 0}, Caps, Handle);
  recv_handshake(#handshake{version=V,caps1=C,length=undefined}=R, Caps, Handle)
    when V >= [4,1,1]; ?IS_SET(C,?CLIENT_PROTOCOL_41) ->
      {ok, U, H} = recv_unsigned(1, Handle),
      recv_handshake(R#handshake{length = U}, Caps, H);
  recv_handshake(#handshake{length=undefined}=R, Caps, Handle) ->
      recv_handshake(R#handshake{length = 8}, Caps, Handle);   % 8?, TODO
  recv_handshake(#handshake{version=V,caps1=C,reserved=undefined}=R, Caps, Handle)
    when V >= [4,1,1]; ?IS_SET(C,?CLIENT_PROTOCOL_41) ->
      {ok, B, H} = recv_binary(10, Handle),
      recv_handshake(R#handshake{reserved = B}, Caps, H); % "always 0"
  recv_handshake(#handshake{reserved=undefined}=R, Caps, Handle) ->
      {ok, B, H} = recv_binary(13, Handle),
      recv_handshake(R#handshake{reserved = B}, Caps, H); % "always 0"?
  recv_handshake(#handshake{version=V,caps1=C,seed2=undefined}=R, Caps, Handle)
    when V >= [4,1,1]; ?IS_SET(C,?CLIENT_PROTOCOL_41) ->
      {ok, B, H} = recv_text(<<0>>, Handle),
      recv_handshake(R#handshake{seed2 = B}, Caps, H);
  recv_handshake(#handshake{seed2=undefined}=R, Caps, Handle) ->
      recv_handshake(R#handshake{seed2 = <<>>}, Caps, Handle);
  recv_handshake(#handshake{version=V,caps1=C,plugin=undefined}=R, Caps, Handle)
    when V >= [4,1,1]; ?IS_SET(C,?CLIENT_PROTOCOL_41) ->
      {ok, B, H} = recv_text(<<0>>, Handle),
      recv_handshake(R#handshake{plugin = B}, Caps, H);
  recv_handshake(#handshake{plugin=undefined}=R, Caps, Handle) ->
      recv_handshake(R#handshake{plugin = <<"mysql_native_password">>}, Caps, Handle);
  