MySQL R34..
#1

I'm using MySQL R34 at the moment. At the moment I'm trying to work out the usage of ORM functions.

Firstly: What's beneficial about them?
Secondly: Is it faster than manual queries?
Thirdly: When you use "orm_addvar_int" etc under OnPlayerConnect, is this assigning my enumerations so I don't need to keep using orm_add_int etc...

The tutorial didn't explain the third one

Also, How do I update something using ORM, for example saving and loading factions
Reply
#2

First: I'd say it's easier and much more flexible than cache version ( I like it )

Second: of course it's faster than version r6 below, but compared to r7+ (cache version) it's faster but it is not worth converting to orm, it's just little speed difference as said on this tutorial: https://sampforum.blast.hk/showthread.php?tid=461766

Third: I believe there is no orm_add_int and yes after you use orm_addvar_int, it stores the value it got from the row.

pawn Код:
orm_addvar_int(id, eNum[playerid][pKills], "Kills");
//native funct(accountid, enum, gets the information from 'kills' row and store it in eNum[playerid][pKills]
- I hope you understand what I mean, but if you don't have any knowledge about MySQL, I suggest you reading the SA-MP Wiki and AndreT's Tutorial on orm
Reply
#3

I meant orm_addvar_int not orm_add_int xD.

Thanks for the reply dude, I've started using orm's lately as it seems a hell of alot less work. I'm trying to use the latest stuff to prevent lag to as much as i can.

One Last Question:
Can I still manually query things? Like use ORM and mysql_tquery?
Reply
#4

Yes, you can.
Reply
#5

Alright thanks.

I've made a race check thingy, though what is the purpose? I heard it was something about threaded queries.. Just want to confirm it. I added it just incase..

Last question for now, thanks guys.
Reply
#6

The quote from maddinat0r explains what race condition is.

Quote:
Originally Posted by maddinat0r
race condition check:
player A connects -> SELECT query is fired -> this query takes very long
while the query is still processing, player A with playerid 2 disconnects
player B joins now with playerid 2 -> our laggy SELECT query is finally finished, but for the wrong player

what do we do against it?
we create a connection count for each playerid and increase it everytime the playerid connects or disconnects
we also pass the current value of the connection count to our OnPlayerDataLoaded callback
then we check if current connection count is the same as connection count we passed to the callback
if yes, everything is okay, if not, we just kick the player
Reply
#7

Are you referring to the race condition check? A player connects and it executes the query to load their data. For some reason, the query takes more than it should and the player disconnects. Another player connects with the same playerid and finally the query is finished but it will assign the data to the wrong player.
Reply
#8

Ah. Well thanks the two of you, for the help. +1rep to you both if i can
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)