Tabela: columns: pole: { type: float }
generuje następujący SQL dla MySQLa:
CREATE TABLE tabela (id BIGINT AUTO_INCREMENT, pole FLOAT(18, 2), PRIMARY KEY(id)) ENGINE = INNODB;
Czy to prawidłowe zachowania? Czy dla Doctrinowego typu "float" nie powinien być generowany MySQL-owy float lub double bez narzuconej precyzji?
http://www.doctrine-project.org/documentat...ata-types:float
Dokumentacja Doctrine 1.2 mówi:
Cytat
The float data type may store floating point decimal numbers. This data type is suitable for representing numbers withina large scale range that do not require high accuracy. The scale and the precision limits of the values that may be stored in a database depends on the DBMS that it is used.
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html
Documentacja MySQL 5.0 mówi:
Cytat
For maximum portability, code requiring storage of approximate numeric data values should use FLOAT or DOUBLE PRECISION with no specification of precision or number of digits.
https://github.com/doctrine/doctrine1/blob/...aDict/Mysql.php
Więc dlaczego precyzja dla float i double jest wymagana i jeśli jej nie podamy to Doctrine uparcie doda ją samo?
case 'float': $scale = !empty($field['scale']) ? $field['scale'] : $this->conn->getAttribute(Doctrine_Core::ATTR_DECIMAL_PLACES); return 'FLOAT('.$length.', '.$scale.')';