SQL mapper find "IS NULL"

25 views
Skip to first unread message

Diego Cano Lagneaux

unread,
Jul 18, 2017, 8:14:17 AM7/18/17
to Fat-Free Framework
I'm trying to get all the entries with the "parent" field set as null.
What should work, as far as I know, is: 

$enties->find("parent IS NULL");

However, it doesn't work. In file /db/sql/mapper.php, lines 332-3, this code:
implode(',',array_map([$this->db,'quotekey'],
array_keys($this->fields)))).$adhoc,$filter,$options,$ttl);

surrounds every word in quotes, transforming the filters into " 'parent' 'IS' 'NULL' ", which obviously does not work.

Diego Cano Lagneaux

unread,
Jul 18, 2017, 10:19:39 AM7/18/17
to Fat-Free Framework
I'm sorry, I'm an idiot. I forgot I was not using straight F3 Mapper, but Cortex. After careful bug tracking I found the issue.
In file ikkez/f3-cortex/libdb/cortex.php, I changed line 2346 from:

if (preg_match('/\b(AND|OR|IN|LIKE|NOT)\b/i',$match[2]))
into

if (preg_match('/\b(IS|NULL|AND|OR|IN|LIKE|NOT)\b/i',$match[2]))

I'm going to go and file a bug directly in the Cortex github.
Reply all
Reply to author
Forward
0 new messages