完成实验7和报告

This commit is contained in:
2024-06-03 23:34:50 +08:00
parent 6fd325207b
commit 168664058a
8 changed files with 461 additions and 24 deletions

View File

@@ -1,22 +0,0 @@
执行语句: DROP TABLE IF EXISTS passengers;
执行语句: DROP TRIGGER IF EXISTS BeforeInsertPassenger;
执行语句: DROP TRIGGER IF EXISTS BeforeModifyPassengerInfo;
执行语句: DROP PROCEDURE IF EXISTS RegisterPassenger;
执行语句: DROP PROCEDURE IF EXISTS VerifyUser;
执行语句: DROP PROCEDURE IF EXISTS ModifyPassengerInfo;
执行语句: CREATE TABLE passengers (
ID BIGINT PRIMARY KEY,
`Name` VARCHAR (255) NOT NULL,
Phone_number BIGINT UNIQUE NOT NULL,
`Password` VARCHAR (255) NOT NULL,
CHECK (ID REGEXP '^\\d{18}$'),
CHECK (Phone_number REGEXP '^\\d{11}$')
);
执行语句: DELIMITER //
CREATE TRIGGER BeforeInsertPassenger
BEFORE INSERT ON passengers
FOR EACH ROW
BEGIN
DECLARE id_exist INT DEFAULT 0;
执行过程中出现错误: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER //\n\nCREATE TRIGGER BeforeInsertPassenger\nBEFORE INSERT ON passengers\nF' at line 1")

View File

@@ -4,7 +4,7 @@ import pymysql
db_config = {
'host': 'localhost',
'user': 'kejingfan',
'password': 'KJF2811879',
'password': 'xxxxxxxx',
'database': 'DBLab_7_1',
'charset': 'utf8mb4',
'cursorclass': pymysql.cursors.DictCursor

View File

@@ -10,7 +10,7 @@ app.secret_key = os.environ.get('SECRET_KEY', 'OPTIONALSECRETKEY')
def get_db():
return pymysql.connect(
host='localhost', user='kejingfan',
password='KJF2811879', database='DBLab_7_1',
password='xxxxxxxx', database='DBLab_7_1',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor
)