anchor.diff:  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %% Utility functions in module
   
  -connect_database(TcpMod, Sock, Username, Password, Database, PageSize, AcceptVersion, IsCreateDB, State) ->
  +connect_database(TcpMod, Sock, Username, Password, Database, PageSize, IsCreateDB, State) ->
       case IsCreateDB of
           true ->
  -            create_database(TcpMod, Sock, Username, Password, Database, PageSize, AcceptVersion, State);
  +            create_database(TcpMod, Sock, Username, Password, Database, PageSize, State);
           false ->
  -            attach_database(TcpMod, Sock, Username, Password, Database, AcceptVersion, State)
  -    end.
  -
  -attach_database(TcpMod, Sock, User, Password, Database, AcceptVersion, State) ->
  -    TcpMod:send(Sock,
  -        efirebirdsql_op:op_attach(User, Password, Database, AcceptVersion)),
  +            attach_database(TcpMod, Sock, Username, Password, Database, State)
  +    end.
  +
  +attach_database(TcpMod, Sock, User, Password, Database, State) ->
  +    TcpMod:send(Sock,
  +        efirebirdsql_op:op_attach(User, Password, Database, State#state.accept_version)),
       R = case efirebirdsql_op:get_response(TcpMod, Sock) of
           {op_response, {ok, Handle, _}} -> {ok, Handle};
           {op_response, {error, Msg}} ->{error, Msg}
  
positive.code:         efirebirdsql_op:op_connect(Host, Username, Password, Database, State#state.public_key, State#state.wire_crypt)),
      case efirebirdsql_op:get_response(TcpMod, Sock) of
          {op_accept, {AcceptVersion, _AcceptType}} ->
              connect_database(TcpMod, Sock, Username, Password, Database, PageSize, AcceptVersion, IsCreateDB, State);
          {op_cond_accept, {_AcceptVersion, _AcceptType}} ->
              io:format("op_cond_accept");
          {op_accept_data, {_AcceptVersion, _AcceptType}} ->
  
negative.code:         {ok, DbHandle} ->
              case allocate_statement(TcpMod, Sock, DbHandle) of
                  {ok, StmtHandle} ->
                      {ok, State#state{db_handle = DbHandle, stmt_handle = StmtHandle}};
                  {error, Msg2} ->
                      {{error, Msg2}, State#state{db_handle = DbHandle}}
              end;
          {error, Msg3} ->
              {{error, Msg3}, State}
  