Database

Started by FarisDon, Jul 11, 2015, 08:35 PM

Previous topic - Next topic

FarisDon

Well i wanna ask that i am not totally sure that DB saves it data automatically its data as you guys know that we use registery system and lots of stuff in db , and i am not much famlier with it! , so i don't actually know that it saves data Automatically , and if it does in what occasions it does?like when i am crashed does it save my data?i am 80% sure it does , but as you know guys confusions are not usually gone.

DizzasTeR

When YOU exit the server, then ( if you have defined the update queries function ofcourse ) it WILL save the data. That doesn't matter how you exit crash/leave/timeout etc

but if server crashed then there is no possibility to save the data, but that doesn't mean to run timers to save all the stats of players, don't make your script like so that it crashes and you're good to go.

EK.IceFlake

Quote from: Doom_Killer on Jul 11, 2015, 08:53 PMWhen YOU exit the server, then ( if you have defined the update queries function ofcourse ) it WILL save the data. That doesn't matter how you exit crash/leave/timeout etc

but if server crashed then there is no possibility to save the data, but that doesn't mean to run timers to save all the stats of players, don't make your script like so that it crashes and you're good to go.
I'm not sure about you, but for me I can easily run 2 queries per second

Thijn

Nothing get's saved automatically. If you're doing it right, at least.

On join you get the data from the database. While the player is playing you save it every few minutes and keep the current stats in memory (The famous pInfo class). When the player quits you save it as well.
If your server crashes the most current player info wont be saved, because there isn't any function being called that does the actual saving.

EK.IceFlake

Quote from: Thijn on Jul 11, 2015, 09:13 PMNothing get's saved automatically. If you're doing it right, at least.

On join you get the data from the database. While the player is playing you save it every few minutes and keep the current stats in memory (The famous pInfo class). When the player quits you save it as well.
If your server crashes the most current player info wont be saved, because there isn't any function being called that does the actual saving.
I'm doing it very right and I use the db every time I need to make an update. In other words your statement has been proven false.

DizzasTeR

@NE.CrystalBlue, As long as you are running queries that doesn't save shit load of data it might be fine, but if you are using it for accounts work then probably the pure lag which once your server had I don't  remember the name is legit.

I myself load stats on joining, and update the tables when the player leaves, except for that im not running any timers to save/update player datas and the reason I'm doing that is because my server usually never crashes.

You use db everytime, I can't call you a decent scripter then cus you are not looking forward for efficiency.


P.s: sorry if any mistake, written from phone.

FarisDon

#6
Well i asked this as we enter the data into the DB By Insert it saves until we do well i think the better way is that i should make arrays , and in player part it should save its stats right?, but i want a free advise from you guys that as i see timers are being worst and the cause is "Crash" , so should i add timers to save data everytime , but i think its worst i should only add the save thing in player part right?

EK.IceFlake

Quote from: Doom_Killer on Jul 11, 2015, 09:31 PM@NE.CrystalBlue, As long as you are running queries that doesn't save shit load of data it might be fine, but if you are using it for accounts work then probably the pure lag which once your server had I don't  remember the name is legit.

I myself load stats on joining, and update the tables when the player leaves, except for that im not running any timers to save/update player datas and the reason I'm doing that is because my server usually never crashes.

You use db everytime, I can't call you a decent scripter then cus you are not looking forward for efficiency.


P.s: sorry if any mistake, written from phone.
The only reason I switched from ini to SQLite is the speed. Also the queries I execute made the price of the robbing points go higher, but now I made the timer into a (10?) second timeout.

DizzasTeR

Quote from: FarisDon on Jul 12, 2015, 04:25 AMWell i asked this as we enter the data into the DB By Insert it saves until we do well i think the better way is that i should make arrays , and in player part it should save its stats right?, but i want a free advise from you guys that as i see timers are being worst and the cause is "Crash" , so should i add timers to save data everytime , but i think its worst i should only add the save thing in player part right?

Depends on you, if you think your scripts won't crash then I must say use arrays to update data live and when player leaves then update the data in database from the player's data stored in array.

@NE.CrystalBlue, if you want speed, go for MySQL then, but running queries the whole time seems stupid to me.

FarisDon

Quote from: Doom_Killer on Jul 12, 2015, 09:57 AM
Quote from: FarisDon on Jul 12, 2015, 04:25 AMDepends on you, if you think your scripts won't crash then I must say use arrays to update data live and when player leaves then update the data in database from the player's data stored in array.

@NE.CrystalBlue, if you want speed, go for MySQL then, but running queries the whole time seems stupid to me.
Well i asked this as we enter the data into the DB By Insert it saves until we do well i think the better way is that i should make arrays , and in player part it should save its stats right?, but i want a free advise from you guys that as i see timers are being worst and the cause is "Crash" , so should i add timers to save data everytime , but i think its worst i should only add the save thing in player part right?
Well actually many people save their data in last they don't update their data first like when we deposit,so i had made my script excellent even a single change will be updated automatically like when i deposit money when i get it when i buy the vehicle , and its count etc.Thats stupidness  Crystal in 0.3 i did the same mistake , and now i got punish for it.

EK.IceFlake

Quote from: FarisDon on Jul 12, 2015, 10:55 AM
Quote from: Doom_Killer on Jul 12, 2015, 09:57 AM
Quote from: FarisDon on Jul 12, 2015, 04:25 AMDepends on you, if you think your scripts won't crash then I must say use arrays to update data live and when player leaves then update the data in database from the player's data stored in array.

@NE.CrystalBlue, if you want speed, go for MySQL then, but running queries the whole time seems stupid to me.
Well i asked this as we enter the data into the DB By Insert it saves until we do well i think the better way is that i should make arrays , and in player part it should save its stats right?, but i want a free advise from you guys that as i see timers are being worst and the cause is "Crash" , so should i add timers to save data everytime , but i think its worst i should only add the save thing in player part right?
Well actually many people save their data in last they don't update their data first like when we deposit,so i had made my script excellent even a single change will be updated automatically like when i deposit money when i get it when i buy the vehicle , and its count etc.Thats stupidness  Crystal in 0.3 i did the same mistake , and now i got punish for it.
What is stupidness and how you got punish?

EK.IceFlake

Quote from: Doom_Killer on Jul 12, 2015, 09:57 AM
Quote from: FarisDon on Jul 12, 2015, 04:25 AMWell i asked this as we enter the data into the DB By Insert it saves until we do well i think the better way is that i should make arrays , and in player part it should save its stats right?, but i want a free advise from you guys that as i see timers are being worst and the cause is "Crash" , so should i add timers to save data everytime , but i think its worst i should only add the save thing in player part right?

Depends on you, if you think your scripts won't crash then I must say use arrays to update data live and when player leaves then update the data in database from the player's data stored in array.

@NE.CrystalBlue, if you want speed, go for MySQL then, but running queries the whole time seems stupid to me.
I had set it up, tried connecting to MySQL server and shit happened...