exchange_do_get_link_data.sql (1725B)
1 -- 2 -- This file is part of TALER 3 -- Copyright (C) 2014--2022 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 17 CREATE OR REPLACE FUNCTION exchange_do_get_link_data( 18 IN in_coin_pub BYTEA 19 ) 20 RETURNS SETOF record 21 LANGUAGE plpgsql 22 AS $$ 23 DECLARE 24 curs CURSOR 25 FOR 26 SELECT 27 melt_serial_id 28 FROM refresh_commitments 29 WHERE old_coin_pub=in_coin_pub; 30 31 DECLARE 32 i RECORD; 33 BEGIN 34 OPEN curs; 35 LOOP 36 FETCH NEXT FROM curs INTO i; 37 EXIT WHEN NOT FOUND; 38 RETURN QUERY 39 SELECT 40 tp.transfer_pub 41 ,denoms.denom_pub 42 ,rrc.ev_sig 43 ,rrc.ewv 44 ,rrc.link_sig 45 ,rrc.freshcoin_index 46 ,rrc.coin_ev 47 FROM refresh_revealed_coins rrc 48 JOIN refresh_transfer_keys tp 49 ON (tp.melt_serial_id=rrc.melt_serial_id) 50 JOIN denominations denoms 51 ON (rrc.denominations_serial=denoms.denominations_serial) 52 WHERE rrc.melt_serial_id =i.melt_serial_id 53 /* GROUP BY tp.transfer_pub, denoms.denom_pub, rrc.ev_sig,rrc.ewv,rrc.link_sig,rrc.freshcoin_index, rrc.coin_ev*/ 54 ORDER BY tp.transfer_pub, 55 rrc.freshcoin_index ASC 56 ; 57 END LOOP; 58 CLOSE curs; 59 END $$;