From 8df5335515a1499596d8f15969101be4ce28e826 Mon Sep 17 00:00:00 2001 From: Vianpyro Date: Tue, 12 Nov 2024 18:40:49 -0500 Subject: [PATCH] Weird test to revert if not working --- create_get_procedures.sql | 108 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/create_get_procedures.sql b/create_get_procedures.sql index 2018633..43cf0b3 100644 --- a/create_get_procedures.sql +++ b/create_get_procedures.sql @@ -10,6 +10,10 @@ BEGIN SELECT player_id, player_name, email, gold, created_at, last_login FROM player; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_player_by_id(IN player_id INT) BEGIN SELECT player_id, player_name, email, gold, created_at, last_login @@ -17,6 +21,10 @@ BEGIN WHERE id = player_id; END // +DELIMITER ; + +DELIMITER // + 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 @@ -24,6 +32,10 @@ BEGIN WHERE player_name = player_name; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_player_worlds(IN player_id INT) BEGIN SELECT w.world_id, w.world_name, w.world_description, w.created_at @@ -32,6 +44,10 @@ BEGIN WHERE pw.player_id = player_id; END // +DELIMITER ; + +DELIMITER // + 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 @@ -39,6 +55,10 @@ BEGIN WHERE c.owner_id = player_id; END // +DELIMITER ; + +DELIMITER // + -- World Procedures CREATE OR REPLACE PROCEDURE get_all_worlds() @@ -48,6 +68,10 @@ BEGIN FROM world; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_world_by_id(IN world_id INT) BEGIN SELECT world_id, world_name, world_description, seed, action_speed, unit_speed, trade_speed, @@ -56,6 +80,10 @@ BEGIN WHERE world_id = world_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_active_worlds() BEGIN SELECT world_id, world_name, world_description, created_at @@ -63,6 +91,10 @@ BEGIN WHERE STATUS = 1; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_players_in_world(IN world_id INT) BEGIN SELECT p.player_id, p.player_name, p.email, p.gold, p.created_at @@ -71,6 +103,10 @@ BEGIN WHERE pw.world_id = world_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_world_islands(IN world_id INT) BEGIN SELECT island_id, x, y @@ -78,6 +114,10 @@ BEGIN WHERE world_id = world_id; END // +DELIMITER ; + +DELIMITER // + -- Island Procedures CREATE OR REPLACE PROCEDURE get_all_islands() @@ -86,6 +126,10 @@ BEGIN FROM island; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_island_by_id(IN island_id INT) BEGIN SELECT island_id, x, y, world_id @@ -93,6 +137,10 @@ BEGIN WHERE island_id = island_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_island_cities(IN island_id INT) BEGIN SELECT city_id, city_name, x, y, owner_id @@ -100,6 +148,10 @@ BEGIN WHERE island_id = island_id; END // +DELIMITER ; + +DELIMITER // + -- City Procedures CREATE OR REPLACE PROCEDURE get_all_cities() @@ -108,6 +160,10 @@ BEGIN FROM city; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_city_by_id(IN city_id INT) BEGIN SELECT city_id, city_name, x, y, island_id, owner_id @@ -115,6 +171,10 @@ BEGIN WHERE id = city_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_cities_in_world(IN world_id INT) BEGIN SELECT c.city_id, c.city_name, c.x, c.y, c.owner_id, c.island_id @@ -123,6 +183,10 @@ BEGIN WHERE i.world_id = world_id; END // +DELIMITER ; + +DELIMITER // + -- Building Procedures CREATE OR REPLACE PROCEDURE get_all_buildings() @@ -131,6 +195,10 @@ BEGIN FROM building; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_city_buildings(IN city_id INT) BEGIN SELECT building_id, building_name, building_level, max_level @@ -138,6 +206,10 @@ BEGIN WHERE city_id = city_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_building_by_id(IN building_id INT) BEGIN SELECT building_id, building_name, building_level, max_level, city_id @@ -145,6 +217,10 @@ BEGIN WHERE id = building_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_building_prerequisites(IN building_id INT) BEGIN SELECT prerequisite_id @@ -152,6 +228,10 @@ BEGIN WHERE building_id = building_id; END // +DELIMITER ; + +DELIMITER // + -- Unit Procedures CREATE OR REPLACE PROCEDURE get_all_units() @@ -162,6 +242,10 @@ BEGIN FROM unit; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_city_units(IN city_id INT) BEGIN SELECT u.unit_id, u.unit_name, cu.quantity @@ -170,6 +254,10 @@ BEGIN WHERE cu.city_id = city_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_unit_by_id(IN unit_id INT) BEGIN SELECT unit_id, unit_name, unit_description, unit_type, wood_cost, stone_cost, silver_cost, @@ -179,6 +267,10 @@ BEGIN WHERE id = unit_id; END // +DELIMITER ; + +DELIMITER // + -- Battle Procedures CREATE OR REPLACE PROCEDURE get_all_battles() @@ -188,6 +280,10 @@ BEGIN FROM battle; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_battle_by_id(IN battle_id INT) BEGIN SELECT battle_id, attacker_id, defender_id, battle_time, winner_id, loser_id, loot_wood, @@ -196,6 +292,10 @@ BEGIN WHERE id = battle_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_player_battles(IN player_id INT) BEGIN SELECT battle_id, attacker_id, defender_id, battle_time, winner_id, loser_id, loot_wood, @@ -204,6 +304,10 @@ BEGIN WHERE attacker_id = player_id OR defender_id = player_id; END // +DELIMITER ; + +DELIMITER // + CREATE OR REPLACE PROCEDURE get_battle_units(IN battle_id INT) BEGIN SELECT unit_id, quantity, side @@ -211,6 +315,10 @@ BEGIN WHERE battle_id = battle_id; END // +DELIMITER ; + +DELIMITER // + -- Miscellaneous Procedures CREATE OR REPLACE PROCEDURE get_building_requirements(IN building_id INT)