Closed (cannot reproduce)
Project:
Rules
Version:
7.x-2.x-dev
Component:
Rules Engine
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jul 2009 at 20:09 UTC
Updated:
6 Sep 2011 at 08:27 UTC
I am looking for a way to use sql query in condition of rule - if sql query returns something - proceed with rule, if it returns nothing - skip rule. Can anyone suggest way to go in this case? Thanks.
Comments
Comment #1
klausiAdd a condition to your rule and select "execute custom PHP code".
Insert something like
Comment #2
henrijs.seso commentedThanks klausi!
Maybe this could be made as part of rules. Instead of sql query user can choose created view as condition.
Comment #3
mitchell commented@mansspams: Please describe "view as condition" in #508550: Integration with Views module.
Comment #4
fagoapart from using views for that I think having it as a separate condition where user could hand-write SQL would be nice too.
Comment #5
mitchell commented@fago: Would this be an additional condition or could some help text with the PHP condition suffice?
Comment #6
fagoA separate condition, but it should help the user with using the usual placeholders %s %d.
Comment #7
henrijs.seso commented... and replacing tokens right in the query
Comment #8
fagouhm no, that would allow sql injection.. This should only be possible for the placeholders... Thus forcing the user to go with placeholders for dynamic stuff is important.
Comment #9
mitchell commented@fago: If there's no longer a php action in rules, and there's pdo support in core, then this feature probably doesn't make sense. Do you agree?
Comment #10
fagoIt would still make sense, but I'm unsure whether this is something that should ship with rules itself.
Comment #11
mitchell commentedComment #12
klausiClosed since no further information has been provided. Reopen if still an issue.