MySQL Update
#1

Hi guys,

whats the best way to save a single row in a MySQL-database?
There are 109 rows to update (each Player, each account).

1. format a > 2500 string, concatenates the string with strcat, and send as a query?
2. Sending 5 Querys, with a length of ~500?
3. Or Sending 109 Querys, with a length of ~50?

I tried to do this in one query (1), with a 2500-big-string, but my Server has got a few
problems with it (crashdetect, see below).

Код:
[23:19:32] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[23:19:32] [debug]  Stack pointer (STK) is 0x30EFF8, heap pointer (HEA) is 0x30F6EC
[23:19:32] [debug] AMX backtrace:
[23:19:32] [debug] #0 ???????? in public JB_OnPlayerDisconnect () from lssf.amx
[23:19:32] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[23:19:32] [debug] #2 ???????? in public Streamer_OnPlayerDisconnect () from lssf.amx
[23:19:32] [debug] #3 native CallLocalFunction () [00471e90] from samp-server.exe
[23:19:32] [debug] #4 ???????? in public OnPlayerDisconnect () from lssf.amx
[23:19:32] [debug] #5 native Ban () [0046ef20] from samp-server.exe
[23:19:32] [debug] #6 ???????? in public JB_OnPlayerCommandText () from lssf.amx
[23:19:32] [debug] #7 native CallLocalFunction () [00471e90] from samp-server.exe
[23:19:32] [debug] #8 ???????? in public OnPlayerCommandText () from lssf.amx
Reply
#2

4. Don't put everything in a single table and only update stuff when it's needed.
Reply
#3

I only save the player's Accounts every 10 Minute (sometimes the Server is crashing,
so data won't be lost) and every time a player goes offline.

What do you mean?
Should I create a table for each user?
Reply
#4

No, but if you need a 2500 character long query then you clearly have too many fields (columns). I would set 30 fields as an absolute maximum for a table.
Reply
#5

I'm sure that there are some fields which are a little bit useless,
but a huge script needs huge Information, that needs to be saved in Databases.
(I'm sorry if the grammar is fail)

What do you think should I do?
Create 2 databases, each has ~50 fields?
Reply
#6

s/databases/tables

OP, learn about table relationships, and foreign keys.
Reply
#7

Quote:
Originally Posted by Pille_
Посмотреть сообщение
I'm sure that there are some fields which are a little bit useless,
but a huge script needs huge Information, that needs to be saved in Databases.
(I'm sorry if the grammar is fail)

What do you think should I do?
Create 2 databases, each has ~50 fields?
No, you should normalise your tables if you haven't done so already and set standard values. Also, there is probably stuff that you hardly update, so you can add that to the function itself (e.g. adminlevel).
Reply
#8

Quote:

No, you should normalise your tables if you haven't done so already and set standard values. Also, there is probably stuff that you hardly update, so you can add that to the function itself (e.g. adminlevel).

I don't get it. Of Course I have standard values, like Integer, Float, and strings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)