ReturnType = $ReturnType; if (DEBUG_COLLECTION) echo '__return_type : '."\n"; $this->SQL = $SQL_Result; $this->Length = db_num_rows($this->SQL); if (is_object($Obj)) { $this->ObjClass = get_class($Obj); } else { $this->ObjClass = $Obj; } } public function rewind() { if (DEBUG_COLLECTION) echo '__rewind'."\n"; $this->Pos = 0; db_data_seek($this->SQL, $this->Pos); } public function current() { if (DEBUG_COLLECTION) echo '__current'."\n"; db_data_seek($this->SQL, $this->Pos); switch ($this->ReturnType) { case 'ASSOC': $t = db_fetch_assoc($this->SQL); $this->Key = $t[0]; $this->Value = $t; break; case 'KEY': $t = db_fetch_row($this->SQL); $this->Key = $t[0]; $this->Value = $this->Key; break; case 'COUNT': $t = db_fetch_row($this->SQL); $this->Key = $t[0]; $this->Value = $this->Length; break; case 'OBJECT': default: $t = db_fetch_row($this->SQL); $this->Key = $t[0]; $this->Value = Factory::Build($this->ObjClass, $this->Key); break; } return $this->Value; } public function key() { if (DEBUG_COLLECTION) echo '__key'."\n"; return $this->Key; } public function next() { if (DEBUG_COLLECTION) echo '__next'."\n"; $this->Pos ++; } public function valid() { if (DEBUG_COLLECTION) echo '__valid'."\n"; return ($this->Pos < $this->Length); } } ?>