Class it_dbi:
/**
* Puts next result from previous select() in member variables
* @return true if another record was fetched, false if no more records
* @see select()
*/
function iterate()
{
if (!$this->_nofetch)
{
if ($this->_data = $this->_fetch_assoc($this->_result))
{
if ($localizedfields = $this->_localizedfields)
foreach ($localizedfields as $field => $dummy)
unset($this->$field);
foreach ((array)$this->_dyndata as $field => $dummy)
unset($this->$field);
foreach (($this->_dyndata = ($t = $this->_data['dyncols']) ? (array)json_decode($t, true) : []) as $field => $value)
$this->_data[$field] = $value;
unset($this->_data['dyncols']);
foreach (static::_read_postprocess($this->_data) as $field => $value)
{
$this->$field = (isset($value) && $this->_convertfunc[$field]) ? ($this->_data[$field] = $this->_convertfunc[$field]($value)) : $value;
if (!array_key_exists($field, $this->_data)) # Register fields added by _read_postprocess() so they get clear()ed
$this->_data[$field] = $value;
}
if ($localizedfields)
{
$lang = T_lang();
foreach ($localizedfields as $field => $dummy)
{
$value = $this->{$field . "_" . $lang};
if (!isset($value))
$value = $this->{$field . "_" . $this->_p['localized_defaultlanguage']};
if (isset($value))
{
if (isset($this->$field))
it::fatal("Field name clash: Overwriting {$this->_p['table']}.$field with {$field}_{$lang}, only use one of those fields");
else
$this->$field = $value;
}
}
}
if (!empty($this->_p['keyfield']))
$this->_key = $this->_data[$this->_p['keyfield']];
}
else
{
$this->clear();
}
}
else
$this->_nofetch = false;
return (bool)$this->_data;
}