original_string: public function get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
          global $CFG;
  
          $rs = $this->get_recordset_sql($sql, $params, $limitfrom, $limitnum);
          if (!$rs->valid()) {
              $rs->close(); // Not going to iterate (but exit), close rs
              return false;
          }
          $objects = array();
          foreach($rs as $value) {
              $key = reset($value);
              if ($CFG->debugdeveloper && array_key_exists($key, $objects)) {
                  debugging("Did you remember to make the first column something unique in your call to get_records? Duplicate value '$key' found in column first column of '$sql'.", DEBUG_DEVELOPER);
              }
              $objects[$key] = (object)$value;
          }
          $rs->close();
          return $objects;
      }
code: public function get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
          global $CFG;
  
          $rs = $this->get_recordset_sql($sql, $params, $limitfrom, $limitnum);
          if (!$rs->valid()) {
              $rs->close(); // Not going to iterate (but exit), close rs
              return false;
          }
          $objects = array();
          foreach($rs as $value) {
              $key = reset($value);
              if ($CFG->debugdeveloper && array_key_exists($key, $objects)) {
                  debugging("Did you remember to make the first column something unique in your call to get_records? Duplicate value '$key' found in column first column of '$sql'.", DEBUG_DEVELOPER);
              }
              $objects[$key] = (object)$value;
          }
          $rs->close();
          return $objects;
      }
code_tokens: public function get_records_sql ( $ sql , array $ params = null , $ limitfrom = 0 , $ limitnum = 0 ) { global $ CFG ; $ rs = $ this -> get_recordset_sql ( $ sql , $ params , $ limitfrom , $ limitnum ) ; if ( ! $ rs -> valid ( ) ) { $ rs -> close ( ) ; // Not going to iterate (but exit), close rs return false ; } $ objects = array ( ) ; foreach ( $ rs as $ value ) { $ key = reset ( $ value ) ; if ( $ CFG -> debugdeveloper && array_key_exists ( $ key , $ objects ) ) { debugging ( "Did you remember to make the first column something unique in your call to get_records? Duplicate value '$key' found in column first column of '$sql'." , DEBUG_DEVELOPER ) ; } $ objects [ $ key ] = ( object ) $ value ; } $ rs -> close ( ) ; return $ objects ; }
docstring: Get a number of records as an array of objects.
  
  Return value is like:
  @see function get_records.
  
  @param string $sql the SQL select query to execute. The first column of this SELECT statement
  must be a unique value (usually the 'id' field), as it will be used as the key of the
  returned array.
  @param array $params array of sql parameters
  @param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
  @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
  @return array of objects, or empty array if no records were found, or false if an error occurred.
docstring_tokens: Get a number of records as an array of objects .