original_string: public function delete_questions_usage_by_activities(qubaid_condition $qubaids) {
          $where = "qa.questionusageid {$qubaids->usage_id_in()}";
          $params = $qubaids->usage_id_in_params();
  
          $contextids = $this->db->get_records_sql_menu("
                  SELECT DISTINCT contextid, 1
                  FROM {question_usages}
                  WHERE id {$qubaids->usage_id_in()}", $qubaids->usage_id_in_params());
          foreach ($contextids as $contextid => $notused) {
              $this->delete_response_files($contextid, "IN (
                      SELECT qas.id
                      FROM {question_attempts} qa
                      JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
                      WHERE $where)", $params);
          }
  
          if ($this->db->get_dbfamily() == 'mysql') {
              $this->delete_usage_records_for_mysql($qubaids);
              return;
          }
  
          $this->db->delete_records_select('question_attempt_step_data', "attemptstepid IN (
                  SELECT qas.id
                  FROM {question_attempts} qa
                  JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
                  WHERE $where)", $params);
  
          $this->db->delete_records_select('question_attempt_steps', "questionattemptid IN (
                  SELECT qa.id
                  FROM {question_attempts} qa
                  WHERE $where)", $params);
  
          $this->db->delete_records_select('question_attempts',
                  "{question_attempts}.questionusageid {$qubaids->usage_id_in()}",
                  $qubaids->usage_id_in_params());
  
          $this->db->delete_records_select('question_usages',
                  "{question_usages}.id {$qubaids->usage_id_in()}", $qubaids->usage_id_in_params());
      }
code: public function delete_questions_usage_by_activities(qubaid_condition $qubaids) {
          $where = "qa.questionusageid {$qubaids->usage_id_in()}";
          $params = $qubaids->usage_id_in_params();
  
          $contextids = $this->db->get_records_sql_menu("
                  SELECT DISTINCT contextid, 1
                  FROM {question_usages}
                  WHERE id {$qubaids->usage_id_in()}", $qubaids->usage_id_in_params());
          foreach ($contextids as $contextid => $notused) {
              $this->delete_response_files($contextid, "IN (
                      SELECT qas.id
                      FROM {question_attempts} qa
                      JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
                      WHERE $where)", $params);
          }
  
          if ($this->db->get_dbfamily() == 'mysql') {
              $this->delete_usage_records_for_mysql($qubaids);
              return;
          }
  
          $this->db->delete_records_select('question_attempt_step_data', "attemptstepid IN (
                  SELECT qas.id
                  FROM {question_attempts} qa
                  JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
                  WHERE $where)", $params);
  
          $this->db->delete_records_select('question_attempt_steps', "questionattemptid IN (
                  SELECT qa.id
                  FROM {question_attempts} qa
                  WHERE $where)", $params);
  
          $this->db->delete_records_select('question_attempts',
                  "{question_attempts}.questionusageid {$qubaids->usage_id_in()}",
                  $qubaids->usage_id_in_params());
  
          $this->db->delete_records_select('question_usages',
                  "{question_usages}.id {$qubaids->usage_id_in()}", $qubaids->usage_id_in_params());
      }
code_tokens: public function delete_questions_usage_by_activities ( qubaid_condition $ qubaids ) { $ where = "qa.questionusageid {$qubaids->usage_id_in()}" ; $ params = $ qubaids -> usage_id_in_params ( ) ; $ contextids = $ this -> db -> get_records_sql_menu ( "
                  SELECT DISTINCT contextid, 1
                  FROM {question_usages}
                  WHERE id {$qubaids->usage_id_in()}" , $ qubaids -> usage_id_in_params ( ) ) ; foreach ( $ contextids as $ contextid => $ notused ) { $ this -> delete_response_files ( $ contextid , "IN (
                      SELECT qas.id
                      FROM {question_attempts} qa
                      JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
                      WHERE $where)" , $ params ) ; } if ( $ this -> db -> get_dbfamily ( ) == 'mysql' ) { $ this -> delete_usage_records_for_mysql ( $ qubaids ) ; return ; } $ this -> db -> delete_records_select ( 'question_attempt_step_data' , "attemptstepid IN (
                  SELECT qas.id
                  FROM {question_attempts} qa
                  JOIN {question_attempt_steps} qas ON qas.questionattemptid = qa.id
                  WHERE $where)" , $ params ) ; $ this -> db -> delete_records_select ( 'question_attempt_steps' , "questionattemptid IN (
                  SELECT qa.id
                  FROM {question_attempts} qa
                  WHERE $where)" , $ params ) ; $ this -> db -> delete_records_select ( 'question_attempts' , "{question_attempts}.questionusageid {$qubaids->usage_id_in()}" , $ qubaids -> usage_id_in_params ( ) ) ; $ this -> db -> delete_records_select ( 'question_usages' , "{question_usages}.id {$qubaids->usage_id_in()}" , $ qubaids -> usage_id_in_params ( ) ) ; }
docstring: Delete a question_usage_by_activity and all its associated
  
  You should not call this method directly. You should use
  @link question_engine::delete_questions_usage_by_activities()}.
  
  {@link question_attempts} and {@link question_attempt_steps} from the
  database.
  @param qubaid_condition $qubaids identifies which question useages to delete.
docstring_tokens: Delete a question_usage_by_activity and all its associated