diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 7b0bfea9b..1ed2ae13a 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -658,16 +658,19 @@ class DboMysql extends DboMysqlBase { if ($data === '') { return 'NULL'; } - if ((is_int($data) || is_float($data) || $data === '0') || ( + if (is_float($data)) { + return sprintf('%F', $data); + } + if ((is_int($data) || $data === '0') || ( is_numeric($data) && strpos($data, ',') === false && - $data[0] != '0' && strpos($data, 'e') === false)) { - return $data; - } + $data[0] != '0' && strpos($data, 'e') === false) + ) { + return $data; + } default: - $data = "'" . mysql_real_escape_string($data, $this->connection) . "'"; + return "'" . mysql_real_escape_string($data, $this->connection) . "'"; break; } - return $data; } /** diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index 6c692d942..bd4e8562b 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -299,8 +299,11 @@ class DboPostgres extends DboSource { } switch($column) { - case 'inet': case 'float': + if (is_float($data)) { + $data = sprintf('%F', $data); + } + case 'inet': case 'integer': case 'date': case 'datetime':