anchor.diff:          false -> Sql
       end,
   
  -    C = get_connection(Context),
  -    try
  -        Id = case pgsql:equery1(C, FinalSql, Parameters) of
  -                {ok, IdVal} -> IdVal;
  -                {error, noresult} -> undefined
  -             end,
  -         {ok, Id}
  -    after
  -        return_connection(C, Context)
  -    end.
  +    F = fun(C) ->
  +		Id = case pgsql:equery1(C, FinalSql, Parameters) of
  +			 {ok, IdVal} -> IdVal;
  +			 {error, noresult} -> undefined
  +		     end,
  +		{ok, Id}
  +	end,
  +    with_connection(F, Context).
  +
   
   %% @doc Update a row in a table, merging the props list with any new props values
   %% @spec update(Table, Id, Parameters, Context) -> {ok, RowsUpdated}
  
positive.code:     
  
  get_parameter(Parameter, Context) ->
      C = get_connection(Context),
      try
          {ok, Result} = pgsql:get_parameter(C, z_convert:to_binary(Parameter)),
          Result
      after
          return_connection(C, Context)
      end.
      
  
  %% @doc Return property lists of the results of a query on the database in the Context
  
negative.code: update_sequence(Table, Ids, Context) ->
      assert_table_name(Table),
      Args = lists:zip(Ids, lists:seq(1, length(Ids))),
      F = fun(C) when C =:= none -> 
  		[];
  	   (C) -> 
  		[ {ok, _} = pgsql:equery1(C, "update \""++Table++"\" set seq = $2 where id = $1", Arg) || Arg <- Args ]
  	   end,
      with_connection(F, Context).
  
  
  
  