diff --git a/lib/Doctrine/DataDict/Firebird.php b/lib/Doctrine/DataDict/Firebird.php index a18902c42..6bd0b1e41 100644 --- a/lib/Doctrine/DataDict/Firebird.php +++ b/lib/Doctrine/DataDict/Firebird.php @@ -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'] . '\'.'); diff --git a/lib/Doctrine/DataDict/Mssql.php b/lib/Doctrine/DataDict/Mssql.php index 4385587fd..ec2ca132b 100644 --- a/lib/Doctrine/DataDict/Mssql.php +++ b/lib/Doctrine/DataDict/Mssql.php @@ -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'] . '\'.'); diff --git a/lib/Doctrine/DataDict/Mysql.php b/lib/Doctrine/DataDict/Mysql.php index 109724604..b2f69a052 100644 --- a/lib/Doctrine/DataDict/Mysql.php +++ b/lib/Doctrine/DataDict/Mysql.php @@ -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'] . '\'.'); } diff --git a/lib/Doctrine/DataDict/Oracle.php b/lib/Doctrine/DataDict/Oracle.php index 1c8eebc14..dc01fede1 100644 --- a/lib/Doctrine/DataDict/Oracle.php +++ b/lib/Doctrine/DataDict/Oracle.php @@ -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'] . '\'.'); diff --git a/lib/Doctrine/DataDict/Pgsql.php b/lib/Doctrine/DataDict/Pgsql.php index 000f96fa0..4d0a3bdf7 100644 --- a/lib/Doctrine/DataDict/Pgsql.php +++ b/lib/Doctrine/DataDict/Pgsql.php @@ -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 diff --git a/lib/Doctrine/DataDict/Sqlite.php b/lib/Doctrine/DataDict/Sqlite.php index f417653d1..7a7c6e031 100644 --- a/lib/Doctrine/DataDict/Sqlite.php +++ b/lib/Doctrine/DataDict/Sqlite.php @@ -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); } /**