Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if
- isnull((select lastClick
- from clicks
- where adoptableID=new.adoptableID
- and userID=new.userID)) then
- insert into clicks(userID,adoptableID,lastClick)
- values(new.userID,new.adoptableID,new.lastClick)
- elseif addtime(
- (select lastClick from clicks
- where adoptable.ID=new.adoptableID
- and userID=new.userID), '24:00') <= CURRENT_TIMESTAMP
- then
- update clicks
- set lastClick=CURRENT_TIMESTAMP
- where userID=new.userID
- and adoptableID=new.adoptableID;
- else
- signal sqlstate '45000' set message_text='You must wait one day between clicks.';
- END IF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement