Skip to content
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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Storeitem #2

wants to merge 12 commits into from

Conversation

jhilikkundu
Copy link
Collaborator

  1. for insert,update and delete it is showing error about params.

  2. There is no mistake in number and name of parameters in function

  3. for get_item, there is not any error in terminal but error while showing the result

Copy link
Owner

@say-paul say-paul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check comments

@@ -0,0 +1,8 @@
from utils import database
def dltItem(ItemID):
db=database.Db
Copy link
Owner

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.

from utils import database

def addItem(ItemID,ItemName,ItemUnit,CurrentRate):
db=database.Db
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

from utils import database

def updateInfo(ItemID,ItemName,ItemUnit,CurrentRate):
db= database.Db
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


def updateInfo(ItemID,ItemName,ItemUnit,CurrentRate):
db= database.Db
query=("UPDATE ItemRateChart SET ItemName=%s,ItemUnit=%s,CurrentRate=%s WHERE ItemID=%s")
Copy link
Owner

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?

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)
Copy link
Owner

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?

print("Error: {}".format(error))
return True
self.mariadb_connection.commit()
return self.cursor.lastrowid
Copy link
Owner

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?

print("Error: {}".format(error))
return True
self.mariadb_connection.commit()
return self.cursor.lastrowid
Copy link
Owner

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?

@say-paul
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants