DROP PROCEDURE IF EXISTS `get_product_gallery`;
DELIMITER ;;
CREATE PROCEDURE `get_product_gallery` (
    IN p_product_id INT
)
proc:BEGIN
    DECLARE v_ret INT;
    CALL check_if_product_exists(p_product_id, v_ret);
    IF v_ret != 0 THEN
        SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'get_product_gallery: Product does not exist';
        LEAVE proc;
    END IF;
    SELECT * FROM product_gallery WHERE product_id = p_product_id;
END ;;
DELIMITER ;
