forked from verdnatura/hedera-web
28 lines
533 B
SQL
28 lines
533 B
SQL
/**
|
|
* Registers an email.
|
|
*
|
|
* @param v_mail_id Message-ID of email
|
|
* @param v_sender Origin email id
|
|
**/
|
|
USE edi;
|
|
DROP PROCEDURE IF EXISTS message_new;
|
|
DELIMITER $$
|
|
CREATE PROCEDURE message_new (
|
|
v_mail_id VARCHAR(100)
|
|
,v_sender VARCHAR(150)
|
|
,OUT v_message_id INT
|
|
)
|
|
BEGIN
|
|
DECLARE v_sender_id INT;
|
|
|
|
SELECT id INTO v_sender_id FROM mail
|
|
WHERE mail = v_sender;
|
|
|
|
INSERT IGNORE INTO message SET
|
|
sender_id = v_sender_id
|
|
,mail_id = v_mail_id;
|
|
|
|
SET v_message_id = LAST_INSERT_ID();
|
|
END$$
|
|
DELIMITER ;
|