exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

auditor_do_get_auditor_progress.sql (1388B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2024 Taler Systems SA
      4 --
      5 -- TALER is free software; you can redistribute it and/or modify it under the
      6 -- terms of the GNU General Public License as published by the Free Software
      7 -- Foundation; either version 3, or (at your option) any later version.
      8 --
      9 -- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11 -- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 --
     13 -- You should have received a copy of the GNU General Public License along with
     14 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 --
     16 -- @author Christian Grothoff
     17 
     18 DROP FUNCTION IF EXISTS auditor_do_get_auditor_progress;
     19 CREATE FUNCTION auditor_do_get_auditor_progress(
     20   IN in_keys TEXT[])
     21 RETURNS SETOF INT8
     22 LANGUAGE plpgsql
     23 AS $$
     24 DECLARE
     25   ini_key TEXT;
     26   my_off INT8;
     27 BEGIN
     28   FOREACH ini_key IN ARRAY in_keys
     29   LOOP
     30     SELECT progress_offset
     31       INTO my_off
     32       FROM auditor_progress
     33       WHERE progress_key=ini_key;
     34     IF FOUND
     35     THEN
     36       RETURN NEXT my_off;
     37     ELSE
     38       RETURN NEXT NULL;
     39     END IF;
     40   END LOOP;
     41 END $$;
     42 
     43 COMMENT ON FUNCTION auditor_do_get_auditor_progress(TEXT[])
     44   IS 'Finds all progress offsets associated with the array of keys given as the argument and returns them in order';