Created
March 27, 2019 14:05
-
-
Save OmegaRogue/5ea124d3d21b7f7ea78f6d0f9e647b44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE doturn(PLAYER INT, BRoW INT, BColumn INT) | |
BEGIN | |
DECLARE CellBuffer INT; | |
IF BColumn = 1 THEN | |
SELECT BColumn1 INTO CellBuffer FROM tictactoe WHERE Row = BRoW; | |
IF CellBuffer = 0 THEN | |
UPDATE tictactoe | |
SET BColumn1=PLAYER | |
WHERE Row = BRoW; | |
END IF; | |
END IF; | |
IF BColumn = 2 THEN | |
SELECT BColumn2 INTO CellBuffer FROM tictactoe WHERE Row = BRoW; | |
IF CellBuffer = 0 THEN | |
UPDATE tictactoe | |
SET BColumn2=PLAYER | |
WHERE Row = BRoW; | |
END IF; | |
END IF; | |
IF BColumn = 3 THEN | |
SELECT BColumn3 INTO CellBuffer FROM tictactoe WHERE Row = BRoW; | |
IF CellBuffer = 0 THEN | |
UPDATE tictactoe | |
SET BColumn3=PLAYER | |
WHERE Row = BRoW; | |
END IF; | |
END IF; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment