Advertisement
JoelSjogren

Untitled

Aug 9th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. clear_functions()
  2.  
  3. cur.execute("""
  4. SET @base_value = 3,
  5. @extracting_column = 30,
  6. @number_of_columns = 40,
  7. @number_of_layers = 5,
  8. @active_side = 1;
  9. """)
  10.  
  11. cur.execute(f"""
  12. CREATE FUNCTION numbering_formula
  13. (
  14. layer INT,
  15. side INT,
  16. column_ INT
  17. )
  18. RETURNS int
  19. BEGIN
  20. IF NOT (1 <= layer AND layer <= number_of_layers AND (side = 1 OR side = 2) AND 1 <= column_ AND column_ <= number_of_columns AND column_ != extracting_column) THEN
  21. return -1
  22. END IF;
  23.  
  24. IF @active_side <> 1 THEN
  25. SET side = flip_side(side);
  26. END IF;
  27.  
  28. return 0;
  29. END
  30. """)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement