下面我有两个按预期工作的查询。 CodeIgniter如何知道不向第二个查询添加2 where子句?它是否在$ this-> db-> update?
之后重置查询语句 //Make sure customers don't belong to tier anymore
$this->db->where('tier_id', $tier_id);
$this->db->update('customers', array('tier_id' => NULL));
$this->db->where('id', $tier_id);
return $this->db->delete('price_tiers');
答案 0 :(得分:0)
如果你查看System / database / db_active_rec.php核心文件,你可以看到(例如)update()函数
它首先要做的是:
// Combine any cached components with the current statements
$this->_merge_cache();
这就是CRUD语句如何收集任何“部分”where where子句。
它做的倒数第二个是调用:
_reset_write();
这会将它们全部重置为空。然后它调用query()来发送语句