MySql
#3

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
The database structure you are describing has many flows:
• 50 unused columns
• duplicates

Try to maintain 15-20 columns per table and not more.
Having the same item multiple times when can be combined into one is not good either.

The ideal database structure would be like the current one: <userid>, <itemid>, <amount>
But instead of sending a DELETE query and multiple INSERT, combine them.

A player can have an item only once so <userid>, <itemid> is a UNIQUE constraint. If set like this, when executing a query such:
pawn Код:
"INSERT INTO Inventory VALUES (%d, %d, %d) ON DUPLICATE KEY UPDATE amount=%d;"
It will do either of these:
• Insert a new record if it does not exist.
• Update amount of item for X player and Y item.
We have 55 colums in total and it worked fine before. I just need to re-script the querie for that.(Since we're on a DayZ, and thats the inventory system. But still, thanks for the help I really appreciate that.
Reply


Messages In This Thread
MySql - by DarkMythHunter - 19.06.2018, 12:16
Re: MySql - by Calisthenics - 19.06.2018, 12:37
Re: MySql - by DarkMythHunter - 19.06.2018, 13:14

Forum Jump:


Users browsing this thread: 1 Guest(s)