Skip to content

Commit

Permalink
Minor refactorings + fix for dbo mysqli related to previous commit
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8261 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
DarkAngelBGE committed Jul 28, 2009
1 parent f88cc56 commit f710ae7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cake/libs/model/datasources/dbo/dbo_mysqli.php
Expand Up @@ -204,19 +204,22 @@ function value($data, $column = null, $safe = false) {
return 'NULL'; return 'NULL';
} }
if ($data === '' && $column !== 'integer' && $column !== 'float' && $column !== 'boolean') { if ($data === '' && $column !== 'integer' && $column !== 'float' && $column !== 'boolean') {
return "''"; return "''";
} }
if (empty($column)) { if (empty($column)) {
$column = $this->introspectType($data); $column = $this->introspectType($data);
} }


switch ($column) { switch ($column) {
case 'boolean': case 'boolean':
$data = $this->boolean((bool)$data); return $this->boolean((bool)$data);
break; break;
case 'integer' : case 'integer' :
case 'float' : case 'float' :
case null : case null :
if ($data === '') {
return 'NULL';
}
if ((is_int($data) || is_float($data) || $data === '0') || ( if ((is_int($data) || is_float($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)) {
Expand Down

0 comments on commit f710ae7

Please sign in to comment.