Some SQL Changes

pull/6/head
Hailey Clark 6 years ago
parent d978d7be88
commit db72d9d9b0
  1. 8
      appdb.py

@ -55,8 +55,8 @@ def setNewUser(google_id, refresh_token, name, email, verified):
#This statement is for creating a user into the account table. #This statement is for creating a user into the account table.
db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb) db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb)
cur = db.cursor() cur = db.cursor()
cur.execute("INSERT INTO account (`name`, `email`, `refresh_token`, `google_id`, `verified_email`) VALUES \ cur.execute("INSERT INTO account (`name`, `email`, `refresh_token`, `google_id`, `verified_email`, `created`, `last_modified`) VALUES \
(%s, %s, %s, %s, %s)",(name, email, refresh_token, google_id, verified)) (%s, %s, %s, %s, %s, NOW(), NOW())",(name, email, refresh_token, google_id, verified))
db.commit() db.commit()
db.close() db.close()
return True return True
@ -88,7 +88,7 @@ def getDIDsbyAccount(account_id):
cur.execute("SELECT number,provider FROM dids WHERE account_id=%s",(account_id)) cur.execute("SELECT number,provider FROM dids WHERE account_id=%s",(account_id))
rows = cur.fetchall() rows = cur.fetchall()
db.close() db.close()
return rows return rows
def authIdforDID(account_id,did): def authIdforDID(account_id,did):
@ -106,7 +106,7 @@ def setRefreshToken(refresh_token, google_id):
db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb) db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb)
cur = db.cursor() cur = db.cursor()
cur.execute("UPDATE account SET refresh_token=%s WHERE google???",(refresh_token)) cur.execute("UPDATE account SET refresh_token=%s WHERE google_id=%s",(refresh_token, google_id))
db.commit() db.commit()
db.close() db.close()
return True return True

Loading…
Cancel
Save