Skip to content

Commit 902c986

Browse files
authored
check for affected rows in update_item
1 parent 5fa05c0 commit 902c986

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • SOLUTIONS/bhumikaborkar7_solutions/test_playground/intermediate

SOLUTIONS/bhumikaborkar7_solutions/test_playground/intermediate/sql_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ def update_item(item_id: int, name: str = None, price: float = None) -> bool:
7272
cur.execute(sql, params)
7373
conn.commit()
7474
conn.close()
75-
return True # hint: better to check affected rows
75+
if(cur.rowcount>0):
76+
return True
77+
else:
78+
return False # hint: better to check affected rows
7679

7780

7881
def delete_item(item_id: int) -> bool:

0 commit comments

Comments
 (0)