Lauro Araujo - 2009-05-14 18:47:52
Hi,
Many of the dbf files I'm working with store float values as NUMERIC fields, and the Record class treats these as integers:
function getObject($columnObj){
...
case DBFFIELD_TYPE_NUMERIC : return $this->getInt($columnObj);
}
I suggest the creation of a new function getNumeric() that can read both int and float:
case DBFFIELD_TYPE_NUMERIC : return $this->getNumeric($columnObj)
function getNumeric($columnObj) {
if ($columnObj->getType()!=DBFFIELD_TYPE_NUMERIC) trigger_error ($columnObj->getName()." is not a Number column", E_USER_ERROR);
$s = $this->forceGetString($columnObj);
if (!$s) return false;
$s = str_replace(",",".",$s);
//Only differs from getInt() here - Checks if numeric, othewise, converts to integer.
if(is_numeric($s)) return $s;
return intval($s);
}