-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storeitem #2
base: master
Are you sure you want to change the base?
Storeitem #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check comments
app/store/delete_item.py
Outdated
@@ -0,0 +1,8 @@ | |||
from utils import database | |||
def dltItem(ItemID): | |||
db=database.Db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Db is a class, so needs to have ( ), chek user module.
app/store/post_item.py
Outdated
from utils import database | ||
|
||
def addItem(ItemID,ItemName,ItemUnit,CurrentRate): | ||
db=database.Db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
app/store/put_item.py
Outdated
from utils import database | ||
|
||
def updateInfo(ItemID,ItemName,ItemUnit,CurrentRate): | ||
db= database.Db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
app/store/put_item.py
Outdated
|
||
def updateInfo(ItemID,ItemName,ItemUnit,CurrentRate): | ||
db= database.Db | ||
query=("UPDATE ItemRateChart SET ItemName=%s,ItemUnit=%s,CurrentRate=%s WHERE ItemID=%s") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if i want to update a single column?
app/store/put_item.py
Outdated
def updateInfo(ItemID,ItemName,ItemUnit,CurrentRate): | ||
db= database.Db | ||
query=("UPDATE ItemRateChart SET ItemName=%s,ItemUnit=%s,CurrentRate=%s WHERE ItemID=%s") | ||
params=(ItemName,ItemUnit,CurrentRate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why params only have 3 value? How to pass the item_id in the where clause?
utils/database.py
Outdated
print("Error: {}".format(error)) | ||
return True | ||
self.mariadb_connection.commit() | ||
return self.cursor.lastrowid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why return last row ID for delete?
utils/database.py
Outdated
print("Error: {}".format(error)) | ||
return True | ||
self.mariadb_connection.commit() | ||
return self.cursor.lastrowid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why retrun last row id for update?
Add nescerray logging, print statement that can be seen in server, for any reqest sent. Add a util named logging, which will print every requests thet comes to server. Pattern like- GET , POST ....., PUT ... and so on. |
for insert,update and delete it is showing error about params.
There is no mistake in number and name of parameters in function
for get_item, there is not any error in terminal but error while showing the result