Re: MySQL plugin ORM usage tutorial -
maddinat0r - 09.09.2013
Quote:
Originally Posted by Aliassassin123456
Thanks for answer so there isn't any reason to replace cache's with ORM
|
Sure there is. ORM-code is way easier to maintain. With the normal cache-stuff, you'd have to edit the code in several places in your script if you wan't to add a new variable and you also would need to edit some queries. With the ORM-system, all you need to do is to add one line.
Re: MySQL plugin ORM usage tutorial -
d711728 - 09.09.2013
Nice!
I like the news.
Re: MySQL plugin ORM usage tutorial -
dusk - 10.09.2013
line:
pawn Code:
orm_addvar_string(pInfo[playerid][ORM_ID],pInfo[playerid][Name],"Name");
Gives me this error:
pawn Code:
error 017: undefined symbol "orm_addvar_string"
I copy pasted the name of the function from the include...I just do not get it...Functions like "orm_addvar_int" are working great.
For now, i'm using orm_addvar instead.
Re: MySQL plugin ORM usage tutorial -
IstuntmanI - 10.09.2013
Quote:
Originally Posted by dusk
line:
pawn Code:
orm_addvar_string(pInfo[playerid][ORM_ID],pInfo[playerid][Name],"Name");
Gives me this error:
pawn Code:
error 017: undefined symbol "orm_addvar_string"
I copy pasted the name of the function from the include...I just do not get it...Functions like "orm_addvar_int" are working great.
For now, i'm using orm_addvar instead.
|
Correct usage:
Code:
native orm_addvar_string(ORM:id, &var, var_maxlen, varname[]);
you used it like:
Code:
native orm_addvar_string(ORM:id, &var, varname[]);
Re: MySQL plugin ORM usage tutorial -
dusk - 10.09.2013
Quote:
Originally Posted by IstuntmanI
Correct usage:
Code:
native orm_addvar_string(ORM:id, &var, var_maxlen, varname[]);
you used it like:
Code:
native orm_addvar_string(ORM:id, &var, varname[]);
|
Why didn't it give me "number of arguments does not match the definition"....
Anyway, thanks for the help.
Now i can say: great job on the plugin
Re: MySQL plugin ORM usage tutorial -
IstuntmanI - 10.09.2013
Quote:
Originally Posted by dusk
Why didn't it give me "number of arguments does not match the definition"....
|
Because it is actually a define:
pawn Code:
#define orm_addvar_string(%0,%1,%2,%3) orm_addvar(%0,%1,DATATYPE_STRING,%2,%3)
and if you don't "complete" the definition perfectly, it will give "undefined symbol" error.
Re: MySQL plugin ORM usage tutorial -
x96664 - 28.10.2013
I can't get how it gets the player's data, so can I have an example how to save the player health and IP and load the health after he logs.
AW: Re: MySQL plugin ORM usage tutorial -
maddinat0r - 28.10.2013
Quote:
Originally Posted by x96664
I can't get how it gets the player's data, so can I have an example how to save the player health and IP and load the health after he logs.
|
There is already such an example in this tutorial here, what is the problem with that example? You better read the tutorial again carefuller.
Re: AW: Re: MySQL plugin ORM usage tutorial -
x96664 - 28.10.2013
Quote:
Originally Posted by maddinat0r
There is already such an example in this tutorial here, what is the problem with that example? You better read the tutorial again carefuller.
|
I read it, and couldn't find it, so could you quote it for me ?
Re : MySQL plugin ORM usage tutorial -
S4t3K - 04.07.2014
Of course you do !
Re: Re : MySQL plugin ORM usage tutorial -
maddinat0r - 05.07.2014
Quote:
Originally Posted by fr1run
Do I need to make SQL Inject protection for ORM?
|
Quote:
Originally Posted by S4t3K
Of course you do !
|
Wrong. The ORM system automatically escapes every string variable.
Re: MySQL plugin ORM usage tutorial -
Inverse - 07.07.2014
I'm loving the ORM support! Development has become really fast.
Re: MySQL plugin ORM usage tutorial -
Pupak - 07.07.2014
Hello! I'd like to use ORM, but I have few concerns.
1. How to handle fields like DATETIME?
2. Does orm_destroy also reset ORM associated variables (like orm_delete does) or do I have to do it manually?
Re: MySQL plugin ORM usage tutorial -
maddinat0r - 07.07.2014
Quote:
Originally Posted by Pupak
Hello! I'd like to use ORM, but I have few concerns.
1. How to handle fields like DATETIME?
2. Does orm_destroy also reset ORM associated variables (like orm_delete does) or do I have to do it manually?
|
1. Just like you would handle them with the standard cache system: as a string.
2. No, it doesn't reset the variables like orm_delete, but that would be a nice addition in R40.
Re: MySQL plugin ORM usage tutorial -
Pupak - 07.07.2014
Quote:
Originally Posted by maddinat0r
1. Just like you would handle them with the standard cache system: as a string.
2. No, it doesn't reset the variables like orm_delete, but that would be a nice addition in R40.
|
Sorry, I didn't explain exactly what I need. I have table called "bans" and it contains field like "DateBanned" which is a DATETIME field and "Duration" which is INT field (ban duration in seconds). There is my problem, with standard cache system I was able to fire this query:
pawn Code:
SELECT UNIX_TIMESTAP(`DateBanned`) + `Duration` FROM `bans` WHERE ...
MySQL server would automatically convert DATETIME field to UNIX timestamp and add ban duration to it, then I could simply compare it with gettime() which is an UNIX timestamp too and see is player allowed to be on the server or is he still banned.
I didn't test this with ORM, but I guess if I do:
pawn Code:
new timestamp;
new ORM:ormid = orm_create("bans");
orm_addvar_int(ormid, timestamp, "UNIX_TIMESTAMP(`DateBanned`)");
It would produce query like this:
pawn Code:
SELECT `UNIX_TIMESTAMP(`DateBanned`)` ...
Which would result in query error. Am I wrong? Is there any other way to do it with ORM or should I stick to standard cache system? It's not a problem, I can mix ORM and cache and use it for different parts of my code, but if it all could be just ORM it would be great.
Re: MySQL plugin ORM usage tutorial -
Glad2BeHere - 30.08.2014
This is an amazing tutorial and really help individuals like myself who have very few knowledge to learn how to use the Mysql plugin better. You're Tutorial Andre been following your Mysql Tutorials and all have helped in the passed
Re: MySQL plugin ORM usage tutorial -
Raefal - 06.09.2014
deleted
Re: MySQL plugin ORM usage tutorial -
DeitY - 26.03.2015
Sorry for late bump.
I have question:
I'm using this system, and around 350 players server starts lagging, and somehow people are loosing stats, i mean their variables are not being saved(lost), while below 300 players everything works fine. Sometimes, password of players are not saved.
And i'm using only orm for account saving , for vehicles/stuff im using Y_INI.
So, my question is, if i transfer whole houses/vehicles/stuff to ORM, and remove Y_INI, what are the chances of loosing variables, or would lag be increased?
Also, what's faster, if i use tquery ( UPDATE variable etc ), or ORM system?
Re: MySQL plugin ORM usage tutorial -
m0k1 - 26.03.2015
Quote:
Originally Posted by DeitY
Sorry for late bump.
I have question:
I'm using this system, and around 350 players server starts lagging, and somehow people are loosing stats, i mean their variables are not being saved(lost), while below 300 players everything works fine. Sometimes, password of players are not saved.
And i'm using only orm for account saving , for vehicles/stuff im using Y_INI.
So, my question is, if i transfer whole houses/vehicles/stuff to ORM, and remove Y_INI, what are the chances of loosing variables, or would lag be increased?
Also, what's faster, if i use tquery ( UPDATE variable etc ), or ORM system?
|
The best thing for you and such big server is to use cache function's (
https://sampwiki.blast.hk/wiki/MySQL/R33#Cache_functions). And about 300+ player's stat's not getting saved, when this bug occur (when you gmx ? when they normaly exit ? ...)
Re: MySQL plugin ORM usage tutorial -
DeitY - 29.03.2015
Quote:
Originally Posted by m0k1
|
Uhm ORM doesnt use any query, plugin does that job itself, neither cache functions, so this won't help me m0k1. Occurs mostly at ddos attacks/high number of players.
So your post still won't help me, anyone else?