|
$this->db->join('product', 'product.productID = order_info.productID AND product.brandID = order_info.brandID','left');
不支持上面的调用方法。
改造:
class CI_DB_active_record extends CI_DB_driver{
//330行
// Strip apart the condition and protect the identifiers if(is_array($cond)){
$cond_arr = $cond;
$cond = array();
foreach($cond_arr as $value){
if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $value, $match))
{
$match[1] = $this->_protect_identifiers($match[1]);
$match[3] = $this->_protect_identifiers($match[3]);
$cond[] = $match[1].$match[2].$match[3];
}
}
$cond = implode(' AND ', $cond);
}else{
if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match))
{
$match[1] = $this->_protect_identifiers($match[1]);
$match[3] = $this->_protect_identifiers($match[3]);
$cond = $match[1].$match[2].$match[3];
}
}
结果:
$this->db->join('product', array('product.productID = order_info.productID','product.brandID = order_info.brandID'),'left');
大家是否觉得有必要加入该特性,或者解决 AND 以后的条件不加 表前缀的BUG。
|
|