I guess I have to do a $xpdo->exec($sql) although I am missing the caching functionality.
-
MODX Staff
- 10,725 Posts
The method splittingred told you is correct and it is the same. The save() method creates an UPDATE statement almost exactly like the one you are saying you need to send using exec(), and will update the db result set cache.
First of all thanks to both of you! You are really helpful and very responsive.
I understand that the method you are suggesting will work. I just have some considerations applying this method on a high traffic environment. Theoretically, two different users could concurrently cause the same query. This query would be served by two servers, or two threads, with different loads. Calculating the count variable on the PHP side and not on the DB side could cause a wrong update.
Probably my question is owed to bad application by myself, which I have to reconsider.