[Tutorial] MySQL plugin ORM usage tutorial
#35

Quote:
Originally Posted by maddinat0r
View Post
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.
Reply


Messages In This Thread
MySQL plugin ORM usage tutorial - by AndreT - 03.09.2013, 12:03
Re: MySQL plugin ORM usage tutorial - by IstuntmanI - 03.09.2013, 12:13
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 03.09.2013, 12:29
Re: MySQL plugin ORM usage tutorial - by Misiur - 03.09.2013, 14:14
Re: MySQL plugin ORM usage tutorial - by x96664 - 03.09.2013, 14:42
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 03.09.2013, 16:28
Re: MySQL plugin ORM usage tutorial - by Vince - 03.09.2013, 17:22
Re: MySQL plugin ORM usage tutorial - by iZN - 03.09.2013, 17:26
Re: MySQL plugin ORM usage tutorial - by dusk - 03.09.2013, 18:12
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 03.09.2013, 18:37
Re: MySQL plugin ORM usage tutorial - by dusk - 03.09.2013, 18:43
Re: MySQL plugin ORM usage tutorial - by x96664 - 03.09.2013, 18:54
Re: MySQL plugin ORM usage tutorial - by dusk - 03.09.2013, 18:57
Re: MySQL plugin ORM usage tutorial - by AndreT - 04.09.2013, 15:28
Re: MySQL plugin ORM usage tutorial - by dusk - 05.09.2013, 14:44
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 05.09.2013, 17:21
Re: MySQL plugin ORM usage tutorial - by dusk - 05.09.2013, 18:19
Re: MySQL plugin ORM usage tutorial - by Aliassassin123456 - 09.09.2013, 08:58
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 09.09.2013, 09:45
Re: MySQL plugin ORM usage tutorial - by Aliassassin123456 - 09.09.2013, 10:32
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 09.09.2013, 11:05
Re: MySQL plugin ORM usage tutorial - by d711728 - 09.09.2013, 20:37
Re: MySQL plugin ORM usage tutorial - by dusk - 10.09.2013, 18:37
Re: MySQL plugin ORM usage tutorial - by IstuntmanI - 10.09.2013, 18:41
Re: MySQL plugin ORM usage tutorial - by dusk - 10.09.2013, 18:44
Re: MySQL plugin ORM usage tutorial - by IstuntmanI - 10.09.2013, 18:46
Re: MySQL plugin ORM usage tutorial - by x96664 - 28.10.2013, 01:19
AW: Re: MySQL plugin ORM usage tutorial - by maddinat0r - 28.10.2013, 17:41
Re: AW: Re: MySQL plugin ORM usage tutorial - by x96664 - 28.10.2013, 21:55
Re : MySQL plugin ORM usage tutorial - by S4t3K - 04.07.2014, 16:16
Re: Re : MySQL plugin ORM usage tutorial - by maddinat0r - 05.07.2014, 16:25
Re: MySQL plugin ORM usage tutorial - by Inverse - 07.07.2014, 09:40
Re: MySQL plugin ORM usage tutorial - by Pupak - 07.07.2014, 20:08
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 07.07.2014, 20:15
Re: MySQL plugin ORM usage tutorial - by Pupak - 07.07.2014, 21:03
Re: MySQL plugin ORM usage tutorial - by Glad2BeHere - 30.08.2014, 00:12
Re: MySQL plugin ORM usage tutorial - by Raefal - 06.09.2014, 22:40
Re: MySQL plugin ORM usage tutorial - by DeitY - 26.03.2015, 13:12
Re: MySQL plugin ORM usage tutorial - by m0k1 - 26.03.2015, 14:26
Re: MySQL plugin ORM usage tutorial - by DeitY - 29.03.2015, 15:03
Re: MySQL plugin ORM usage tutorial - by AroseKhanNiazi - 10.06.2015, 17:56
Re: MySQL plugin ORM usage tutorial - by Konstantinos - 10.06.2015, 19:35
Re: MySQL plugin ORM usage tutorial - by Axuj - 18.07.2015, 16:27
Re: MySQL plugin ORM usage tutorial - by Beanz007 - 22.07.2015, 07:41
Re: MySQL plugin ORM usage tutorial - by maddinat0r - 22.07.2015, 08:27
Re: MySQL plugin ORM usage tutorial - by Beanz007 - 22.07.2015, 10:55

Forum Jump:


Users browsing this thread: 1 Guest(s)