Advertisement
Guest User

dao

a guest
Apr 3rd, 2020
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. from fooditem import FoodItem
  2.  
  3. import sqlite3
  4.  
  5. class DAO():
  6.     def __init__(self):
  7.         self.conn = sqlite3.connect('fooditem.db')
  8.         self.c = self.conn.cursor()
  9.  
  10.     def update_info(self, updated_food):
  11.         with self.conn:
  12.             self.c.execute("UPDATE fooditems SET name=:name, ss=:ss, unit=:unit, cal=:cal, carb=:carb, fat=:fat, "
  13.                         "protein=:protein, fiber=:fiber, sugar=:sugar WHERE name=:name", (updated_food.get_dict()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement