compare() versus addSearchCondition()

Hello all,

I wonder when will we use compare() method and when will we use addSearchCondition() in CDbCriteria? For me the method seems like do a same thing. When read the references, I am not really sure the differences…

Is addSearchCondition() used for LIKE comparison while compare() is using arithmetic comparator?

In cases like this i take a look at the source code. It’s usually faster than waiting for a forum response and gives a better understanding of what’s really going on behind the scenes. Did you try the b[/b] button in the class manual, near the source code hint? If not, you should check it out.

http://www.yiiframework.com/doc/api/1.1/CDbCriteria#compare-detail