original_string: public static function get_sql_fields($alias, $prefix = null) {
          global $CFG;
          $fields = array();
  
          if ($prefix === null) {
              $prefix = str_replace('_', '', static::TABLE) . '_';
          }
  
          // Get the properties and move ID to the top.
          $properties = static::properties_definition();
          $id = $properties['id'];
          unset($properties['id']);
          $properties = array('id' => $id) + $properties;
  
          foreach ($properties as $property => $definition) {
              $as = $prefix . $property;
              $fields[] = $alias . '.' . $property . ' AS ' . $as;
  
              // Warn developers that the query will not always work.
              if ($CFG->debugdeveloper && strlen($as) > 30) {
                  throw new coding_exception("The alias '$as' for column '$alias.$property' exceeds 30 characters" .
                      " and will therefore not work across all supported databases.");
              }
          }
  
          return implode(', ', $fields);
      }
code: public static function get_sql_fields($alias, $prefix = null) {
          global $CFG;
          $fields = array();
  
          if ($prefix === null) {
              $prefix = str_replace('_', '', static::TABLE) . '_';
          }
  
          // Get the properties and move ID to the top.
          $properties = static::properties_definition();
          $id = $properties['id'];
          unset($properties['id']);
          $properties = array('id' => $id) + $properties;
  
          foreach ($properties as $property => $definition) {
              $as = $prefix . $property;
              $fields[] = $alias . '.' . $property . ' AS ' . $as;
  
              // Warn developers that the query will not always work.
              if ($CFG->debugdeveloper && strlen($as) > 30) {
                  throw new coding_exception("The alias '$as' for column '$alias.$property' exceeds 30 characters" .
                      " and will therefore not work across all supported databases.");
              }
          }
  
          return implode(', ', $fields);
      }
code_tokens: public static function get_sql_fields ( $ alias , $ prefix = null ) { global $ CFG ; $ fields = array ( ) ; if ( $ prefix === null ) { $ prefix = str_replace ( '_' , '' , static :: TABLE ) . '_' ; } // Get the properties and move ID to the top. $ properties = static :: properties_definition ( ) ; $ id = $ properties [ 'id' ] ; unset ( $ properties [ 'id' ] ) ; $ properties = array ( 'id' => $ id ) + $ properties ; foreach ( $ properties as $ property => $ definition ) { $ as = $ prefix . $ property ; $ fields [ ] = $ alias . '.' . $ property . ' AS ' . $ as ; // Warn developers that the query will not always work. if ( $ CFG -> debugdeveloper && strlen ( $ as ) > 30 ) { throw new coding_exception ( "The alias '$as' for column '$alias.$property' exceeds 30 characters" . " and will therefore not work across all supported databases." ) ; } } return implode ( ', ' , $ fields ) ; }
docstring: Return the list of fields for use in a SELECT clause.
  
  Having the complete list of fields prefixed allows for multiple persistents to be fetched
  in a single query. Use {@link self::extract_record()} to extract the records from the query result.
  
  @param string $alias The alias used for the table.
  @param string $prefix The prefix to use for each field, defaults to the table name followed by underscore.
  @return string The SQL fragment.
docstring_tokens: Return the list of fields for use in a SELECT clause .