original_string: public function get_action_sql() {
          global $DB;
  
          // In new logs we have a field to pick, and in legacy try get this from action.
          if ($this->filterparams->logreader instanceof logstore_legacy\log\store) {
              $action = $this->get_legacy_crud_action($this->filterparams->action);
              $firstletter = substr($action, 0, 1);
              if ($firstletter == '-') {
                  $sql = $DB->sql_like('action', ':action', false, true, true);
                  $params['action'] = '%'.substr($action, 1).'%';
              } else {
                  $sql = $DB->sql_like('action', ':action', false);
                  $params['action'] = '%'.$action.'%';
              }
          } else if (!empty($this->filterparams->action)) {
               list($sql, $params) = $DB->get_in_or_equal(str_split($this->filterparams->action),
                      SQL_PARAMS_NAMED, 'crud');
              $sql = "crud " . $sql;
          } else {
              // Add condition for all possible values of crud (to use db index).
              list($sql, $params) = $DB->get_in_or_equal(array('c', 'r', 'u', 'd'),
                      SQL_PARAMS_NAMED, 'crud');
              $sql = "crud ".$sql;
          }
          return array($sql, $params);
      }
code: public function get_action_sql() {
          global $DB;
  
          // In new logs we have a field to pick, and in legacy try get this from action.
          if ($this->filterparams->logreader instanceof logstore_legacy\log\store) {
              $action = $this->get_legacy_crud_action($this->filterparams->action);
              $firstletter = substr($action, 0, 1);
              if ($firstletter == '-') {
                  $sql = $DB->sql_like('action', ':action', false, true, true);
                  $params['action'] = '%'.substr($action, 1).'%';
              } else {
                  $sql = $DB->sql_like('action', ':action', false);
                  $params['action'] = '%'.$action.'%';
              }
          } else if (!empty($this->filterparams->action)) {
               list($sql, $params) = $DB->get_in_or_equal(str_split($this->filterparams->action),
                      SQL_PARAMS_NAMED, 'crud');
              $sql = "crud " . $sql;
          } else {
              // Add condition for all possible values of crud (to use db index).
              list($sql, $params) = $DB->get_in_or_equal(array('c', 'r', 'u', 'd'),
                      SQL_PARAMS_NAMED, 'crud');
              $sql = "crud ".$sql;
          }
          return array($sql, $params);
      }
code_tokens: public function get_action_sql ( ) { global $ DB ; // In new logs we have a field to pick, and in legacy try get this from action. if ( $ this -> filterparams -> logreader instanceof logstore_legacy \ log \ store ) { $ action = $ this -> get_legacy_crud_action ( $ this -> filterparams -> action ) ; $ firstletter = substr ( $ action , 0 , 1 ) ; if ( $ firstletter == '-' ) { $ sql = $ DB -> sql_like ( 'action' , ':action' , false , true , true ) ; $ params [ 'action' ] = '%' . substr ( $ action , 1 ) . '%' ; } else { $ sql = $ DB -> sql_like ( 'action' , ':action' , false ) ; $ params [ 'action' ] = '%' . $ action . '%' ; } } else if ( ! empty ( $ this -> filterparams -> action ) ) { list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( str_split ( $ this -> filterparams -> action ) , SQL_PARAMS_NAMED , 'crud' ) ; $ sql = "crud " . $ sql ; } else { // Add condition for all possible values of crud (to use db index). list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( array ( 'c' , 'r' , 'u' , 'd' ) , SQL_PARAMS_NAMED , 'crud' ) ; $ sql = "crud " . $ sql ; } return array ( $ sql , $ params ) ; }
docstring: Helper function which is used by build logs to get action sql and param.
  
  @return array sql and param for action.
docstring_tokens: Helper function which is used by build logs to get action sql and param .