22 lines
461 B
MySQL
22 lines
461 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`visitUser_new`(
|
||
|
vAccess INT
|
||
|
,vSsid VARCHAR(64)
|
||
|
)
|
||
|
BEGIN
|
||
|
DECLARE vUserVisit INT;
|
||
|
|
||
|
INSERT INTO visitUser SET
|
||
|
accessFk = vAccess,
|
||
|
userFk = account.myUser_getId();
|
||
|
|
||
|
SET vUserVisit = LAST_INSERT_ID();
|
||
|
|
||
|
UPDATE userSession SET userVisitFk = vUserVisit
|
||
|
WHERE ssid = vSsid;
|
||
|
|
||
|
DELETE FROM userSession
|
||
|
WHERE lastUpdate < TIMESTAMPADD(HOUR, -1, util.VN_NOW());
|
||
|
END$$
|
||
|
DELIMITER ;
|