Find Query Quirks
4 posts
• Page 1 of 1
Hi,
When doing a Find on a test Db, I am getting some inconsistent behavior. One field is an enum field, which contains gender info, Male, Female, Decline. When I sort on Female, all works well. When I sort Male, I get both male and female record results. Should I avoid using an enum field to sort on? Thanks, Bob
ENUM fields are fine for what you are trying to achieve.ÊÊ This is a bug related to the fact that dataface doesn't do exact matching by default - it does partial matching.Ê Hence It is searching for "male" which happens to match both "male" and "female". Clearly it should do exact matching for enum fields by default.Ê To fix this problem, you can make a change to Dataface/SearchForm.php On line 305 in my version it will have: $qstr .= '&'.urlencode($key).'='.urlencode(implode( ' '.$op.' ', $value)); Change it to: $qstr .= '&'.urlencode($key).'='.urlencode('='.implode( ' '.$op.' =', $value)); This will fix this behavior. -Steve
Re: Find Query Quirks
=> $op = 'AND'; => SELECT * FROM table_name WHERE column1 = 3 AND column1 = 5 AND column1 = 10 IMPOSSIBLE! SELECT * FROM table_name WHERE column1 LIKE '%3%' AND column1 LIKE '%5%' AND column1 LIKE '%10%' POSSIBLE ANSER
4 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 20 guests |