Python:
@app.route('/userSignUp',methods = ['POST'])def userSignUp(): try: #read values from signup form _username = request.form['username'] _email = request.form['email'] _password = request.form['password'] _location = request.form['location'] #valIDate recIEved values if _username and _email and _password and _location: cur = MysqL.connection.cursor() _hashed_password = generate_password_hash(_password) cur.callproc('sp_createuser',(_username,_email,_hashed_password,_location)) data = cur.fetchall() cur.close() if len(data) is 0: MysqL.connection.commit() return Json.dumps({'success':'User created successfully!'}) else: return Json.dumps({'error':str(data[0])}) else: return Json.dumps({'HTML':'<span>Enter the required fIElds</span>'}) except Exception as e: return Json.dumps({'error':str(e)})
sql:
# Create Database for ComicHubCREATE DATABASE ComicHub;# Create table 'users' for ComicHubCREATE table `ComicHub`.`tbl_user` ( `user_ID` BIGINT NulL auto_INCREMENT,`user_username` VARCHAR(45) NulL,`user_email` VARCHAR(45) NulL,`user_password` VARCHAR(45) NulL,`user_location` VARCHAR(66) NulL,PRIMARY KEY (`user_ID`));# PROCEDURE for creating users from passed in dataUSE `ComicHub`;DEliMITER $$CREATE PROCEDURE `sp_createuser` ( IN p_username VARCHAR(20),IN p_email VARCHAR(20),IN p_password VARCHAR(20),IN P_location VARCHAR(20))BEGIN#check if user already exists IF (select exists (select 1 from tbl_user where user_username = p_username) ) THEN select 'Username Already Exists!'; ELSE insert into tbl_user ( user_username,user_email,user_password,user_location ) values ( p_username,p_email,p_password,p_location ); END IF;END$$DEliMITER ;解决方法 没关系,现在修复,我意识到我没有更新MysqL Workbench中的数据库.愚蠢我知道,但这是漫长的一天! 总结
以上是内存溢出为你收集整理的python – 错误1318:PROCEDURE ComicHub.sp_createUser的参数数量不正确;预计3,得到4全部内容,希望文章能够帮你解决python – 错误1318:PROCEDURE ComicHub.sp_createUser的参数数量不正确;预计3,得到4所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)