Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Saving memory usage for large result sets.
Browse files Browse the repository at this point in the history
Store records as standard objects, and only convert to SObjects when accessed.
  • Loading branch information
MidnightLightning committed Jun 20, 2012
1 parent ddcaf8a commit 4896505
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions soapclient/SforceBaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -949,12 +949,10 @@ public function __construct($response) {
if (isset($response->records)) {
if (is_array($response->records)) {
foreach ($response->records as $record) {
$sobject = new SObject($record);
array_push($this->records, $sobject);
array_push($this->records, $record);
};
} else {
$sobject = new SObject($response->records);
array_push($this->records, $sobject);
array_push($this->records, $record);
}
}
}
Expand All @@ -966,7 +964,7 @@ public function setSf(SforceBaseClient $sf) { $this->sf = $sf; } // Dependency I
public function rewind() { $this->pointer = 0; }
public function next() { ++$this->pointer; }
public function key() { return $this->pointer; }
public function current() { return $this->records[$this->pointer]; }
public function current() { return new SObject($this->records[$this->pointer]); }

public function valid() {
while ($this->pointer >= count($this->records)) {
Expand Down

0 comments on commit 4896505

Please sign in to comment.