0

下面我有两个按预期工作的查询。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'); 
4

1 回答 1

0

如果您查看 System/database/db_active_rec.php 核心文件,您可以看到(例如)update() 函数

它做的第一件事是调用:

    // Combine any cached components with the current statements
       $this->_merge_cache();

这就是 CRUD 语句收集任何“部分”where 等子句的方式。

它做的倒数第二件事是调用:

     _reset_write();

这会将它们全部重置为空。然后它调用 query() 来发送语句

于 2013-10-26T22:10:33.597 回答