Unknown expression type 126

I can't execute this query "SELECT id, type, stype, name FROM DevnetProvinces WHERE (name LIKE '%k%' OR type LIKE '%k%') ORDER BY IF(INSTR(name,'k')=0,~0,INSTR(name,'k')) ASC, IF(INSTR(type,'k')=0,~0,INSTR(type,'k')) ASC"

If found a error: Unknown expression type 126;

It this query works well, but can't execute by phalcon : $stmt = new Query($sql,$di);

I think this is caused by the ~

thanks It works