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.