Transactions snippets on user guide are misleading
bunglegrind opened this issue · comments
$this->db->trans_begin();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->query('AND YET ANOTHER QUERY...');
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback();
}
else
{
$this->db->trans_commit();
}
Well, trans_commit can fail (and it does!). The return value (which is actually a boolean) must be checked to ensure the correcteness of the transaction. Same applies to trans_complete