original_string: protected function get_instance_sql() {
          global $DB;
          if ($this->_instancessql === null) {
              $instances = $this->get_enrolment_instances();
              $filter = $this->get_enrolment_filter();
              if ($filter && array_key_exists($filter, $instances)) {
                  $sql = " = :ifilter";
                  $params = array('ifilter'=>$filter);
              } else {
                  $filter = 0;
                  if ($instances) {
                      list($sql, $params) = $DB->get_in_or_equal(array_keys($this->get_enrolment_instances()), SQL_PARAMS_NAMED);
                  } else {
                      // no enabled instances, oops, we should probably say something
                      $sql = "= :never";
                      $params = array('never'=>-1);
                  }
              }
              $this->instancefilter = $filter;
              $this->_instancessql = array($sql, $params, $filter);
          }
          return $this->_instancessql;
      }
code: protected function get_instance_sql() {
          global $DB;
          if ($this->_instancessql === null) {
              $instances = $this->get_enrolment_instances();
              $filter = $this->get_enrolment_filter();
              if ($filter && array_key_exists($filter, $instances)) {
                  $sql = " = :ifilter";
                  $params = array('ifilter'=>$filter);
              } else {
                  $filter = 0;
                  if ($instances) {
                      list($sql, $params) = $DB->get_in_or_equal(array_keys($this->get_enrolment_instances()), SQL_PARAMS_NAMED);
                  } else {
                      // no enabled instances, oops, we should probably say something
                      $sql = "= :never";
                      $params = array('never'=>-1);
                  }
              }
              $this->instancefilter = $filter;
              $this->_instancessql = array($sql, $params, $filter);
          }
          return $this->_instancessql;
      }
code_tokens: protected function get_instance_sql ( ) { global $ DB ; if ( $ this -> _instancessql === null ) { $ instances = $ this -> get_enrolment_instances ( ) ; $ filter = $ this -> get_enrolment_filter ( ) ; if ( $ filter && array_key_exists ( $ filter , $ instances ) ) { $ sql = " = :ifilter" ; $ params = array ( 'ifilter' => $ filter ) ; } else { $ filter = 0 ; if ( $ instances ) { list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( array_keys ( $ this -> get_enrolment_instances ( ) ) , SQL_PARAMS_NAMED ) ; } else { // no enabled instances, oops, we should probably say something $ sql = "= :never" ; $ params = array ( 'never' => - 1 ) ; } } $ this -> instancefilter = $ filter ; $ this -> _instancessql = array ( $ sql , $ params , $ filter ) ; } return $ this -> _instancessql ; }
docstring: Gets an array containing some SQL to user for when selecting, params for
  that SQL, and the filter that was used in constructing the sql.
  
  @global moodle_database $DB
  @return string
docstring_tokens: Gets an array containing some SQL to user for when selecting params for that SQL and the filter that was used in constructing the sql .