-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
where, or_where and or_like mixes #63
Comments
I made the PR#1030 for this issue. |
I have a similar problem. I use this in a loop to programatically produce search queries. $this->db->or_where('part.coef', $coef); I expect coef AND exp OR ..... but instead get: WHERE "part"."coef" = 1 OR "part"."exp" = -7 AND lower(part.name) LIKE '%100n%' ESCAPE '!' OR lower(part.type) LIKE '%100n%' ESCAPE '!' OR lower(part.nbr) LIKE '%100n%' ESCAPE '!' OR lower(manufacturer.name) LIKE '%100n%' ESCAPE '!' OR lower(part_family.name) LIKE '%100n%' ESCAPE '!' OR lower(symbol.name) LIKE '%100n%' ESCAPE '!' OR lower(footprint.name) LIKE '%100n%' ESCAPE '!' |
I have solved this problem by using: the second line just creates a condition that never fails. The resulting condition is: (part.coef=$coef AND part.exp=$exp) AND alwaystrue OR ...... |
Hi,
I'm using this code:
$this->db->where('CustomerId', $searchString);
$this->db->or_where('TaxId', $searchString);
$this->db->or_like('CompanyName ', $searchString, 'both');
$this->db->or_like('Contact ', $searchString, 'both');
$this->db->or_like('ba.City ', $searchString, 'both');
but the sql formed is:
WHERE
CustomerId
= 'SONAE'OR
TaxId
= 'SONAE'AND
CompanyName
LIKE '%SONAE%'OR
Contact
LIKE '%SONAE%'OR
ba
.City
LIKE '%SONAE%'That AND is wrong.
The text was updated successfully, but these errors were encountered: