Welcome Guest, Not a member yet? Register   Sign In
Database - Transaction ... function call part of the transaction
#1

[eluser]Dirk Einecke[/eluser]
Hi,

I've a functions to delete something from the database and I've a function to update the search index table.

In the delete function I use a transaction. Now I want to call the function to update the search index table directly in the delete function in the transaction. Are the queries from the function to update the search index table part of the transaction or not?

Example (simplified):

Code:
function delete_note() {
  $this->db->trans_start();
  $arr_result = $this->db->query('SELECT ...')->result_array();
  $this->db->query('DELETE FROM ...');
  $this->update_search_index();
  $this->db->trans_complete();
  return $arr_result;
}

function update_search_index() {
  $arr_result = $this->db->query('SELECT ...')->result_array();
  $this->db->query('UPDATE ...');
}


Dirk




Theme © iAndrew 2016 - Forum software by © MyBB