Advertisement
themoosemind

Untitled

Jul 17th, 2013
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.43 KB | None | 0 0
  1. delimiter //
  2. CREATE TRIGGER trig_game_uniqueness_check BEFORE INSERT ON chess_games
  3. FOR EACH ROW
  4.   BEGIN
  5.     SELECT `id` INTO TMP_ID FROM `chess_games`
  6.         WHERE `whiteUserID` = [HOW DO I ACCESS THIS?]
  7.             AND `blackUserID` = [HOW DO I ACCESS THIS?]  
  8.             AND `outcome` = -1  
  9.             AND `tournamentID` IS NULL;
  10.     IF TMP_ID IS NULL
  11.         [HOW DO I ABORT INSERTION?]
  12.     END IF;
  13.   END
  14. delimiter ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement