diff --git a/__pycache__/app.cpython-39.pyc b/__pycache__/app.cpython-39.pyc deleted file mode 100644 index 594222b..0000000 Binary files a/__pycache__/app.cpython-39.pyc and /dev/null differ diff --git a/database/DDL.sql b/database/DDL.sql index 5d7916d..9700234 100644 --- a/database/DDL.sql +++ b/database/DDL.sql @@ -28,7 +28,12 @@ ENGINE = InnoDB; INSERT INTO `Skiers` (`Name`, `Address`, `Phone`, `Email`, `Ability`) VALUES ('Alice Alpine', '123 Powder Lane', '5550101', 'alice@example.com', 'Expert'), ('Bob Backcountry', '456 Mogul Way', '5550202', 'bob@example.com', 'Intermediate'), -('Charlie Carver', '789 Shred St', '5550303', 'charlie@example.com', 'Beginner'); +('Charlie Carver', '789 Shred St', '5550303', 'charlie@example.com', 'Beginner'), +('Diana Downhill', '321 Summit Rd', '5550404', 'diana@example.com', 'Advanced'), +('Ethan Edge', '654 Glacier Ave', '5550505', 'ethan@example.com', 'Intermediate'), +('Fiona Freestyle', '987 Aspen Dr', '5550606', 'fiona@example.com', 'Expert'), +('George Glide', '147 Snowcap Blvd', '5550707', 'george@example.com', 'Beginner'), +('Hannah Heli', '258 Powder Peak Ln', '5550808', 'hannah@example.com', 'Advanced'); -- ----------------------------------------------------- diff --git a/database/__pycache__/db_connector.cpython-39.pyc b/database/__pycache__/db_connector.cpython-39.pyc index 4f46144..4fcb53c 100644 Binary files a/database/__pycache__/db_connector.cpython-39.pyc and b/database/__pycache__/db_connector.cpython-39.pyc differ diff --git a/database/db_connector.py b/database/db_connector.py index 475be7c..5944732 100644 --- a/database/db_connector.py +++ b/database/db_connector.py @@ -2,9 +2,9 @@ # Database credentials host = 'classmysql.engr.oregonstate.edu' -user = 'cs340_greemich' -passwd = 'sEXIbytwvBfr' -db = 'cs340_greemich' +user = 'cs340_alyoois' +passwd = '8857' +db = 'cs340_alyoois' def connectDB(host = host, user = user, passwd = passwd, db = db): ''' diff --git a/database/sp_passes.sql b/database/sp_passes.sql new file mode 100644 index 0000000..2859ae5 --- /dev/null +++ b/database/sp_passes.sql @@ -0,0 +1,24 @@ + + +-- create pass sp +DROP PROCEDURE IF EXISTS sp_CreatePass; + +DELIMITER // +create procedure sp_CreatePass( + in p_type varchar(45), + in p_purchaseDate DATETIME, + in p_expirationDate DATETIME, + in p_skiers_SkierID INT, + out p_id int) +BEGIN + insert INTO Passes(Type, PurchaseDate, ExpirationDate, Skiers_SkierID) + VALUES (p_type, p_purchaseDate, p_expirationDate, p_skiers_SkierID); + + -- store the pass id of the last inserted row: + select last_insert_id() into p_id; + -- then display id of the last inserted row + select last_insert_id() AS 'p_new_id'; + + +END // +DELIMITER ; diff --git a/templates/passes.j2 b/templates/passes.j2 index 3c1acbe..b13f8f7 100644 --- a/templates/passes.j2 +++ b/templates/passes.j2 @@ -52,7 +52,7 @@ {% endfor %} --- create passes ------------------------------------------------------------- +

Create Passes