/**
* Normalizes result row.
* @param array
* @return array
*/
public function normalizeRow($row)
{
if ($this->types === NULL) {
$this->types = array();
if ($this->connection->getSupplementalDriver()->supports['meta']) {
// workaround for PHP bugs #53782, #54695
$col = 0;
foreach ($row as $key => $foo) {
$type = $this->getColumnMeta($col++);
if (isset($type['native_type'])) {
$this->types[$key] = Reflection\DatabaseReflection::detectType($type['native_type']);
}
}
}
}
foreach ($this->types as $key => $type) {
$value = $row[$key];
if ($value === NULL || $value === FALSE || $type === Reflection\DatabaseReflection::FIELD_TEXT) {
} elseif ($type === Reflection\DatabaseReflection::FIELD_INTEGER) {
$row[$key] = is_float($tmp = $value * 1) ? $value : $tmp;
} elseif ($type === Reflection\DatabaseReflection::FIELD_FLOAT) {
$row[$key] = (string) ($tmp = (double) $value) === $value ? $tmp : $value;
} elseif ($type === Reflection\DatabaseReflection::FIELD_BOOL) {
$row[$key] = (bool) $value && $value !== 'f' && $value !== 'F';
}
}
return $this->connection->getSupplementalDriver()->normalizeRow($row, $this);
}