Skip to content

Commit e66ec13

Browse files
authored
Merge pull request #86 from lshbluesky/dev/issues85
[Normal] μ‚¬μš©μž 계정 정보λ₯Ό λͺ¨λ‘ 쑰회, μˆ˜μ •ν•˜λŠ” 쿼리 및 ν•¨μˆ˜ κ΅¬ν˜„
2 parents 89ff645 + 978bc38 commit e66ec13

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

β€Žaccount_DB.pyβ€Ž

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
CodeCraft PMS Project
33
파일λͺ… : account_DB.py
4-
λ§ˆμ§€λ§‰ μˆ˜μ • λ‚ μ§œ : 2025/03/24
4+
λ§ˆμ§€λ§‰ μˆ˜μ • λ‚ μ§œ : 2025/04/07
55
"""
66

77
import pymysql
@@ -352,3 +352,39 @@ def edit_user_pw(univ_id, pw):
352352
finally:
353353
cur.close()
354354
connection.close()
355+
356+
# ------------------------------ 계정 정보 쑰회 및 μˆ˜μ • ------------------------------ #
357+
# μ‚¬μš©μž(학생)의 정보λ₯Ό μ‘°νšŒν•˜λŠ” ν•¨μˆ˜
358+
# ν•™λ²ˆμ„ 맀개 λ³€μˆ˜λ‘œ λ°›λŠ”λ‹€
359+
def fetch_student_info(univ_id):
360+
connection = db_connect()
361+
cur = connection.cursor(pymysql.cursors.DictCursor)
362+
363+
try:
364+
cur.execute("SELECT * FROM student WHERE s_no = %s", (univ_id,))
365+
result = cur.fetchone()
366+
return result
367+
except Exception as e:
368+
print(f"Error [fetch_student_info] : {e}")
369+
return e
370+
finally:
371+
cur.close()
372+
connection.close()
373+
374+
# μ‚¬μš©μž(학생)의 계정 정보λ₯Ό μˆ˜μ •ν•˜λŠ” ν•¨μˆ˜
375+
# μˆ˜μ •ν•˜λ €λŠ” λΉ„λ°€λ²ˆν˜Έ, 이메일, 학과와 μˆ˜μ •ν•˜λ €λŠ” μ‚¬μš©μž(학생)의 ν•™λ²ˆμ„ 맀개 λ³€μˆ˜λ‘œ λ°›λŠ”λ‹€
376+
def edit_student_info(pw, email, dno, univ_id):
377+
connection = db_connect()
378+
cur = connection.cursor(pymysql.cursors.DictCursor)
379+
380+
try:
381+
cur.execute("UPDATE student SET s_pw = %s, s_email = %s, dno = %s WHERE s_no = %s", (pw, email, dno, univ_id))
382+
connection.commit()
383+
return True
384+
except Exception as e:
385+
connection.rollback()
386+
print(f"Error [edit_student_info] : {e}")
387+
return e
388+
finally:
389+
cur.close()
390+
connection.close()

0 commit comments

Comments
Β (0)