From ce0316eb3879cb5ed0ea5966c58496cdc40ca549 Mon Sep 17 00:00:00 2001 From: Vianpyro Date: Tue, 12 Nov 2024 18:54:32 -0500 Subject: [PATCH] Fix SQLFluff configuration and standardize procedure delimiters in create_get_procedures.sql --- .sqlfluff | 1 - create_get_procedures.sql | 58 +++++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/.sqlfluff b/.sqlfluff index 2e88908..a9b2870 100644 --- a/.sqlfluff +++ b/.sqlfluff @@ -1,4 +1,3 @@ [sqlfluff] dialect = mariadb max_line_length = 100 -exlude_rules = PRS diff --git a/create_get_procedures.sql b/create_get_procedures.sql index 2018633..2251fca 100644 --- a/create_get_procedures.sql +++ b/create_get_procedures.sql @@ -3,26 +3,26 @@ USE 0ce; -- Player Procedures -DELIMITER // +DELIMITER '' CREATE OR REPLACE PROCEDURE get_all_players() BEGIN SELECT player_id, player_name, email, gold, created_at, last_login FROM player; -END // +END '' CREATE OR REPLACE PROCEDURE get_player_by_id(IN player_id INT) BEGIN SELECT player_id, player_name, email, gold, created_at, last_login FROM player WHERE id = player_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_player_by_name(IN player_name VARCHAR(100)) BEGIN SELECT player_id, player_name, email, gold, created_at, last_login FROM player WHERE player_name = player_name; -END // +END '' CREATE OR REPLACE PROCEDURE get_player_worlds(IN player_id INT) BEGIN @@ -30,14 +30,14 @@ BEGIN FROM world w JOIN player_world pw ON w.world_id = pw.world_id WHERE pw.player_id = player_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_player_cities(IN player_id INT) BEGIN SELECT c.city_id, c.city_name, c.x, c.y, c.island_id FROM city c WHERE c.owner_id = player_id; -END // +END '' -- World Procedures @@ -46,7 +46,7 @@ BEGIN SELECT world_id, world_name, world_description, seed, action_speed, unit_speed, trade_speed, night_bonus, beginner_protection, morale, alliance_cap, world_status, created_at FROM world; -END // +END '' CREATE OR REPLACE PROCEDURE get_world_by_id(IN world_id INT) BEGIN @@ -54,14 +54,14 @@ BEGIN night_bonus, beginner_protection, morale, alliance_cap, world_status, created_at FROM world WHERE world_id = world_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_active_worlds() BEGIN SELECT world_id, world_name, world_description, created_at FROM world WHERE STATUS = 1; -END // +END '' CREATE OR REPLACE PROCEDURE get_players_in_world(IN world_id INT) BEGIN @@ -69,14 +69,14 @@ BEGIN FROM player p JOIN player_world pw ON p.player_id = pw.player_id WHERE pw.world_id = world_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_world_islands(IN world_id INT) BEGIN SELECT island_id, x, y FROM island WHERE world_id = world_id; -END // +END '' -- Island Procedures @@ -84,21 +84,21 @@ CREATE OR REPLACE PROCEDURE get_all_islands() BEGIN SELECT island_id, x, y, world_id FROM island; -END // +END '' CREATE OR REPLACE PROCEDURE get_island_by_id(IN island_id INT) BEGIN SELECT island_id, x, y, world_id FROM island WHERE island_id = island_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_island_cities(IN island_id INT) BEGIN SELECT city_id, city_name, x, y, owner_id FROM city WHERE island_id = island_id; -END // +END '' -- City Procedures @@ -106,14 +106,14 @@ CREATE OR REPLACE PROCEDURE get_all_cities() BEGIN SELECT city_id, city_name, x, y, island_id, owner_id FROM city; -END // +END '' CREATE OR REPLACE PROCEDURE get_city_by_id(IN city_id INT) BEGIN SELECT city_id, city_name, x, y, island_id, owner_id FROM city WHERE id = city_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_cities_in_world(IN world_id INT) BEGIN @@ -121,7 +121,7 @@ BEGIN FROM city c JOIN island i ON c.island_id = i.island_id WHERE i.world_id = world_id; -END // +END '' -- Building Procedures @@ -129,28 +129,28 @@ CREATE OR REPLACE PROCEDURE get_all_buildings() BEGIN SELECT building_id, building_name, building_level, max_level, city_id FROM building; -END // +END '' CREATE OR REPLACE PROCEDURE get_city_buildings(IN city_id INT) BEGIN SELECT building_id, building_name, building_level, max_level FROM building WHERE city_id = city_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_building_by_id(IN building_id INT) BEGIN SELECT building_id, building_name, building_level, max_level, city_id FROM building WHERE id = building_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_building_prerequisites(IN building_id INT) BEGIN SELECT prerequisite_id FROM building_prerequisite WHERE building_id = building_id; -END // +END '' -- Unit Procedures @@ -160,7 +160,7 @@ BEGIN population_cost, training_time, damage, defense_blunt, defense_distance, defense_sharp, speed, can_fly FROM unit; -END // +END '' CREATE OR REPLACE PROCEDURE get_city_units(IN city_id INT) BEGIN @@ -168,7 +168,7 @@ BEGIN FROM unit u JOIN city_unit cu ON u.unit_id = cu.unit_id WHERE cu.city_id = city_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_unit_by_id(IN unit_id INT) BEGIN @@ -177,7 +177,7 @@ BEGIN speed, can_fly FROM unit WHERE id = unit_id; -END // +END '' -- Battle Procedures @@ -186,7 +186,7 @@ BEGIN SELECT battle_id, attacker_id, defender_id, battle_time, winner_id, loser_id, loot_wood, loot_stone, loot_silver FROM battle; -END // +END '' CREATE OR REPLACE PROCEDURE get_battle_by_id(IN battle_id INT) BEGIN @@ -194,7 +194,7 @@ BEGIN loot_stone, loot_silver FROM battle WHERE id = battle_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_player_battles(IN player_id INT) BEGIN @@ -202,14 +202,14 @@ BEGIN loot_stone, loot_silver FROM battle WHERE attacker_id = player_id OR defender_id = player_id; -END // +END '' CREATE OR REPLACE PROCEDURE get_battle_units(IN battle_id INT) BEGIN SELECT unit_id, quantity, side FROM battle_unit WHERE battle_id = battle_id; -END // +END '' -- Miscellaneous Procedures @@ -218,6 +218,6 @@ BEGIN SELECT required_wood, required_stone, required_silver, required_population FROM building_requirement WHERE building_id = building_id; -END // +END '' DELIMITER ;