[Include] PVar database - The easiest way for a user database - SQLITE, MYSQL
#21

Quote:
Originally Posted by Gammix
View Post
What i meant was sort of similar to this logic.
Example:
Code:
SavePVar(playerid, "Test");
// The execute interval has started

// New variables added (query isn't executed)
SavePVar(playerid, "Test2");
SavePVar(playerid, "Test3");
SavePVar(playerid, "Test4");

// After 'X' seconds (say 2 secs), the query is executed and result is free!
(similar with loading functions)
The problem with this is things can go wrong, like what if that player disconnected within those 2 seconds? Or what if the server crashed? Or anything else that causes interruptions.

Giving the users the ability to run transactions would solve this.

Code:
//Single Query
SavePVar(playerid, "Test0");

//Multiple Queries
StartPVarQuery(); // Macro for db_query("BEGIN")
SavePVar(playerid, "Test");
SavePVar(playerid, "Test2");
SavePVar(playerid, "Test3");
SavePVar(playerid, "Test4");
EndPVarQuery(); // Macro for db_query("COMMIT")
Also, transactions are super quick, so this would speed up a lot of things. Transactions can run extreme amounts of queries in a single swoop in a very small amount of time.
Reply
#22

Quote:
Originally Posted by Crayder
View Post
The problem with this is things can go wrong, like what if that player disconnected within those 2 seconds? Or what if the server crashed? Or anything else that causes interruptions.

Giving the users the ability to run transactions would solve this.

Code:
//Single Query
SavePVar(playerid, "Test0");

//Multiple Queries
StartPVarQuery(); // Macro for db_query("BEGIN")
SavePVar(playerid, "Test");
SavePVar(playerid, "Test2");
SavePVar(playerid, "Test3");
SavePVar(playerid, "Test4");
EndPVarQuery(); // Macro for db_query("COMMIT")
Also, transactions are super quick, so this would speed up a lot of things. Transactions can run extreme amounts of queries in a single swoop in a very small amount of time.
Yes that's a very nice way, even that can be an alternative for YouSQL or EasyDB.
But, just few extra lines out of standard :P

Also, this can be resolved easily because player's name can be stored into the timer when the execute timer begins.
Reply
#23

Can this still be used with MYSQL R41-2?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)