강상위

getReservations modified

- return parametes changed
- reservations_id, user_id, facility_id, start_time, end_time
- => reservations_id, user_id, facility_id, location, location_detail, capacity, start_time, end_time
......@@ -24,7 +24,9 @@ import datetime
# input:
# string user_id
# output:
# 성공시 : tuple형태로 반환 => ( (1 ,"steven123", 7, datetime.datetime(2018,12,5,12,0,0), datetime.datetime(2018,12,5,12,10,0), ), )
# 성공시 : tuple형태로 반환 => ( (1 ,"steven123", 7, "전자정보대학", "136호", 10, datetime.datetime(2018,12,5,12,0,0), datetime.datetime(2018,12,5,12,10,0), ), )
# 순서 : reservations_id, user_id, facility_id, location, location_detail, capacity, start_time, end_time
# 실패시 : tuple형태로 반환 => ( ("SQL Error!", ), )
# 사용예:
# result = getReservations("khucse123")
......@@ -35,7 +37,8 @@ def getReservations(user_id):
db = pymysql.connect(host='1.201.139.92', port=3306, user=user_info.user_id, password=user_info.user_passwd, db='FRS', charset='utf8')
curs = db.cursor()
curs.execute("select * from reservations where user_id=%s", user_id)
#curs.execute("select * from reservations where user_id=%s", user_id)
curs.execute("select r.reservations_id, r.user_id, r.facility_id, f.location, f.location_detail, f.capacity, r.start_time, r.end_time from reservations r, facilities f where r.user_id=%s AND r.facility_id=f.facility_id;", user_id)
result = curs.fetchall()
print("Fetch Success!")
return result
......@@ -108,5 +111,3 @@ def addReservations(user_id, facility_id, start_time, end_time):
finally:
db.close()
......