Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. user_id = '3'
  2. departure = 'Пенза'
  3. landing = 'Питер'
  4. data = '25.07.2018'
  5.  
  6.  
  7. def verification_id():
  8. with sqlite3.connect("mydatabase_users.db") as con:
  9. cur = con.cursor()
  10. cur.execute("SELECT user_id FROM id_departure_landing_data")
  11. return [x[0] for x in cur.fetchall()]
  12.  
  13.  
  14. def update_bd():
  15. connection = sqlite3.connect("mydatabase_users.db")
  16. cursor = connection.cursor()
  17. if user_id in verification_id():
  18. cursor.execute("UPDATE id_departure_landing_data SET departure='Пенза' WHERE departure='Киров'")
  19. connection.commit()
  20. connection.close()
  21. else:
  22. cursor.execute("INSERT INTO id_departure_landing_data VALUES(?,?,?,?)",
  23. (user_id, departure, None, None))
  24.  
  25. connection.commit()
  26. connection.close()
  27.  
  28.  
  29. update_bd()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement