Merge pull request #381 from AngryPHPNerd/patch-2

MINOR: Colliding field check runs twice
This commit is contained in:
Sam Minnée 2012-05-02 14:14:40 -07:00
commit a004acfb59

View File

@ -1158,18 +1158,10 @@ class MySQLQuery extends SS_Query {
public function numRecords() { public function numRecords() {
if(is_object($this->handle)) return $this->handle->num_rows; if(is_object($this->handle)) return $this->handle->num_rows;
} }
public function nextRecord() { public function nextRecord() {
if(is_object($this->handle) && $data = $this->handle->fetch_row()) { if(is_object($this->handle) && ($data = $this->handle->fetch_assoc())) {
$output = array(); return $data;
$this->handle->field_seek(0);
while($field = $this->handle->fetch_field()) {
$columnName = $field->name;
if(isset($data[$this->handle->current_field-1]) || !isset($output[$columnName])) {
$output[$columnName] = $data[$this->handle->current_field-1];
}
}
return $output;
} else { } else {
return false; return false;
} }