- added ability to set scale at runtime
This commit is contained in:
parent
fd0c11073c
commit
ad0f389870
@ -93,7 +93,8 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
|
||||
return 'DOUBLE PRECISION';
|
||||
case 'decimal':
|
||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||
return 'DECIMAL('.$length.','.$this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES).')';
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES);
|
||||
return 'DECIMAL('.$length.','.$scale.')';
|
||||
}
|
||||
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
|
@ -108,7 +108,8 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
|
||||
return 'FLOAT';
|
||||
case 'decimal':
|
||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||
return 'DECIMAL('.$length.','.$this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES).')';
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES);
|
||||
return 'DECIMAL('.$length.','.$scale.')';
|
||||
}
|
||||
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
|
@ -216,7 +216,8 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
|
||||
return 'DOUBLE';
|
||||
case 'decimal':
|
||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||
return 'DECIMAL('.$length.','.$this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES).')';
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES);
|
||||
return 'DECIMAL('.$length.','.$scale.')';
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
|
@ -92,7 +92,8 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
|
||||
case 'double':
|
||||
return 'NUMBER';
|
||||
case 'decimal':
|
||||
return 'NUMBER(*,'.$this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES).')';
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES);
|
||||
return 'NUMBER(*,'.$scale.')';
|
||||
default:
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
|
@ -417,7 +417,8 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
||||
return 'FLOAT8';
|
||||
case 'decimal':
|
||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||
return 'NUMERIC(' . $length . ',' . $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES) . ')';
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES);
|
||||
return 'NUMERIC('.$length.','.$scale.')';
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
@ -548,7 +549,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
||||
|
||||
return array('type' => $type,
|
||||
'length' => $length,
|
||||
'unsigned' => $unsigned,
|
||||
'unsigned' => $unsigned,
|
||||
'fixed' => $fixed);
|
||||
}
|
||||
/**
|
||||
@ -606,7 +607,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
||||
}
|
||||
/**
|
||||
* parseBoolean
|
||||
* parses a literal boolean value and returns
|
||||
* parses a literal boolean value and returns
|
||||
* proper sql equivalent
|
||||
*
|
||||
* @param string $value boolean value to be parsed
|
||||
|
@ -115,7 +115,8 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
|
||||
//($this->conn->options['fixed_float']+2).','.$this->conn->options['fixed_float'].')' : '');
|
||||
case 'decimal':
|
||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||
return 'DECIMAL('.$length.','.$this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES).')';
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES);
|
||||
return 'DECIMAL('.$length.','.$scale.')';
|
||||
}
|
||||
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||
}
|
||||
@ -237,7 +238,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
|
||||
|
||||
return array('type' => $type,
|
||||
'length' => $length,
|
||||
'unsigned' => $unsigned,
|
||||
'unsigned' => $unsigned,
|
||||
'fixed' => $fixed);
|
||||
}
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user