1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-10 16:14:57 +02:00

code smoothing

This commit is contained in:
David Grudl
2009-11-16 01:51:49 +01:00
parent 4b2a329127
commit 5e7774404b
3 changed files with 12 additions and 10 deletions

View File

@@ -417,26 +417,28 @@ final class DibiTranslator extends DibiObject
// without modifier procession
if (is_string($value))
if (is_string($value)) {
return $this->driver->escape($value, dibi::TEXT);
if (is_int($value) || is_float($value))
} elseif (is_int($value) || is_float($value)) {
return rtrim(rtrim(number_format($value, 5, '.', ''), '0'), '.');
if (is_bool($value))
} elseif (is_bool($value)) {
return $this->driver->escape($value, dibi::BOOL);
if ($value === NULL)
} elseif ($value === NULL) {
return 'NULL';
if ($value instanceof IDibiVariable)
} elseif ($value instanceof IDibiVariable) {
return $value->toSql($this, NULL);
if ($value instanceof DateTime)
} elseif ($value instanceof DateTime) {
return $this->driver->escape($value, dibi::DATETIME);
$this->hasError = TRUE;
return '**Unexpected ' . gettype($value) . '**';
} else {
$this->hasError = TRUE;
return '**Unexpected ' . gettype($value) . '**';
}
}