Fixing failing tests in DboMysql and DboPostgres related to localized floats. Refs #1029

This commit is contained in:
mark_story 2010-08-21 00:49:40 -04:00
parent eb96d8acfb
commit 12d4b52f10
2 changed files with 13 additions and 7 deletions

View file

@ -658,16 +658,19 @@ class DboMysql extends DboMysqlBase {
if ($data === '') { if ($data === '') {
return 'NULL'; 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 && is_numeric($data) && strpos($data, ',') === false &&
$data[0] != '0' && strpos($data, 'e') === false)) { $data[0] != '0' && strpos($data, 'e') === false)
return $data; ) {
} return $data;
}
default: default:
$data = "'" . mysql_real_escape_string($data, $this->connection) . "'"; return "'" . mysql_real_escape_string($data, $this->connection) . "'";
break; break;
} }
return $data;
} }
/** /**

View file

@ -299,8 +299,11 @@ class DboPostgres extends DboSource {
} }
switch($column) { switch($column) {
case 'inet':
case 'float': case 'float':
if (is_float($data)) {
$data = sprintf('%F', $data);
}
case 'inet':
case 'integer': case 'integer':
case 'date': case 'date':
case 'datetime': case 'datetime':