pyup.py 469 B

12345678910111213141516
  1. #!/usr/bin/python3
  2. import pymysql
  3. db = pymysql.connect(host="222.73.129.15", port=31306, user="root", passwd="kepaiteng!QAZ", db="eq", charset="utf8")
  4. cursor = db.cursor()
  5. sqlname =input("请输入sqlname:")
  6. try:
  7. sqlstr =open("%s.sql"%(sqlname),"r",encoding="utf-8").read()
  8. print(sqlstr)
  9. sql ="update apisql set sqlstr =%s where sqlname =%s"
  10. err=cursor.execute(sql,(sqlstr,sqlname))
  11. print(err)
  12. db.commit()
  13. except:
  14. db.rollback()
  15. db.close()