MySQL error handling
#5

Quote:
Originally Posted by Juvanii
Посмотреть сообщение
- You should use player name instead of player id in saving data for the player in mysql because player id's keep changing after the player disconnect then reconnect, it's not stable.

- SET command is used with UPDATE not with INSERT.

- INSERT is used if there is no data for this player yet in the table.

- UPDATE is used if you want to update an existed data for a player.

Example:

INSERT INTO table_name (column1_name, column2_name ...) VALUES (data1, data2)

UPDATE table_name SET column1_name = 'something', column2_name = 'something' WHERE playername = 'iiNzTicTx'
pID := auto increment primary key representing an account ID in the MySQL database.
Using playernames will actually be bad in performance cost since you are comparing strings. Also you can use SET with INSERT. I often prefer SET for readability. Also don't forget to index playernames if you do use them. Indexing produces a 'most used' list or priority list to go through when searching records by a particular field.
As I said the question is to do with error handling. I'm aware there may be errors, after all it's simply a plan! I do appreciate answers, don't take me wrong since it develops ideas etc.
Reply


Messages In This Thread
MySQL error handling - by iiNzTicTx - 11.11.2017, 07:53
Re: MySQL error handling - by woot - 11.11.2017, 08:11
Re: MySQL error handling - by iiNzTicTx - 11.11.2017, 08:17
Re: MySQL error handling - by Juvanii - 11.11.2017, 08:38
Re: MySQL error handling - by iiNzTicTx - 11.11.2017, 09:06

Forum Jump:


Users browsing this thread: 1 Guest(s)