Skip to content

Instantly share code, notes, and snippets.

@OmegaRogue
Created March 27, 2019 14:05
Show Gist options
  • Save OmegaRogue/5ea124d3d21b7f7ea78f6d0f9e647b44 to your computer and use it in GitHub Desktop.
Save OmegaRogue/5ea124d3d21b7f7ea78f6d0f9e647b44 to your computer and use it in GitHub Desktop.
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