You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If $useSoftDeletes = true in the model and you perform a query that has OR in it... the returned results are not correct because the part of the query proceeding deleted=0 is not enclosed in parentheses:
SELECT * FROM user WHERE email LIKE '%kyle%' ESCAPE '!' OR first_name LIKE '%kyle%' ESCAPE '!' OR last_name LIKE '%kyle%' ESCAPE '!' AND deleted = 0
it should be like:
SELECT * FROM user WHERE (email LIKE '%kyle%' ESCAPE '!' OR first_name LIKE '%kyle%' ESCAPE '!' OR last_name LIKE '%kyle%' ESCAPE '!') AND deleted = 0
Trying to make that happen inside of the model/query builder relationship could prove pretty darn tricky to get right. Anytime or's are used a dev has to be more careful. This functions in the same that other major frameworks I've used work. I think it's just something the developer will need to be aware of at this time.
If $useSoftDeletes = true in the model and you perform a query that has OR in it... the returned results are not correct because the part of the query proceeding deleted=0 is not enclosed in parentheses:
SELECT * FROM
user
WHEREemail
LIKE '%kyle%' ESCAPE '!' ORfirst_name
LIKE '%kyle%' ESCAPE '!' ORlast_name
LIKE '%kyle%' ESCAPE '!' ANDdeleted
= 0it should be like:
SELECT * FROM
user
WHERE (email
LIKE '%kyle%' ESCAPE '!' ORfirst_name
LIKE '%kyle%' ESCAPE '!' ORlast_name
LIKE '%kyle%' ESCAPE '!') ANDdeleted
= 0Using query builder:
$this->like('email', $keyword)->orLike('first_name', $keyword)->orLike('last_name', $keyword)->findAll();
Alpha 3
The text was updated successfully, but these errors were encountered: