Welcome Guest, Not a member yet? Register   Sign In
4.1.3 => 4.1.5 DB Builder adding db prefix to table alias
#1

(This post was last modified: 11-16-2021, 12:30 PM by JoelC.)

After updating form CI 4.1.3 to 4.1.5 the query builder is adding the database prefix ( 'tbl' ) to an aliased table ( 'Profiles p' ) in the where statement of this query.
The previous version of CI did not add the database prefix in the orLike method.

Example:

PHP Code:
$searchString 'test'

$builder $this->db->table('Profiles p')
        ->select('p.ProfileID, p.FName, p.LName, p.EMail, p.SecondaryEMail')
        ->groupStart()
            ->orLike('p.FName'$searchString)
            ->orLike('p.LName'$searchString)
            ->orLike('p.Email'$searchString)
            ->orLike('p.SecondaryEMail'$searchString)
        ->groupEnd()
        ->limit(10); 
This produces the SQL string of:
Code:
SELECT `p`.`ProfileID`, `p`.`FName`, `p`.`LName`, `p`.`EMail`, `p`.`SecondaryEMail`
FROM `tblProfiles` `p`
WHERE  (`tbl``p`.`FName` LIKE '%test%' ESCAPE '!'OR  `tbl``p`.`LName` LIKE '%test%' ESCAPE '!'OR  `tbl``p`.`Email` LIKE '%test%' ESCAPE '!'OR  `tbl``p`.`SecondaryEMail` LIKE '%test%' ESCAPE '!' )
LIMIT 10
Reply


Messages In This Thread
4.1.3 => 4.1.5 DB Builder adding db prefix to table alias - by JoelC - 11-16-2021, 11:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB