anchor.diff:  -export([
       has_connection/1,
       transaction/2,
  +    transaction/3,
       transaction_clear/1,
       set/3,
       get/2,
  
positive.code: 
  %% @doc Perform a function inside a transaction, do a rollback on exceptions
  %% @spec transaction(Function, Context) -> FunctionResult | {error, Reason}
  transaction(Function, #context{dbc=undefined} = Context) ->
      case has_connection(Context) of
          true ->
              Host     = Context#context.host,
              {ok, C}  = pgsql_pool:get_connection(Host),
              Context1 = Context#context{dbc=C},
              Result = try
                          {ok, [], []} = pgsql:squery(C, "BEGIN"),
                          R = Function(Context1),
                          {ok, [], []} = pgsql:squery(C, "COMMIT"),
                          R
                       catch
                          _:Why ->
  
negative.code:         false ->
              {rollback, {no_database_connection, erlang:get_stacktrace()}}
      end;
  transaction1(Function, Context) ->
      % Nested transaction, only keep the outermost transaction
      Function(Context).
      
      
  
  %% @doc Clear any transaction in the context, useful when starting a thread with this context.
  transaction_clear(#context{dbc=undefined} = Context) ->
  