Skip to content

Commit

Permalink
Quote false as 0 (thanks to Vaclav Boch)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Sep 17, 2011
1 parent 63f25bd commit c4cd8bd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions NotORM/Result.php
Expand Up @@ -178,10 +178,13 @@ protected function quote($val) {
if (is_float($val)) {
return sprintf("%F", $val); // otherwise depends on setlocale()
}
return (is_int($val) || $val instanceof NotORM_Literal // number or SQL code - for example "NOW()"
? (string) $val
: $this->notORM->connection->quote($val)
);
if ($val === false) {
return "0";
}
if (is_int($val) || $val instanceof NotORM_Literal) { // number or SQL code - for example "NOW()"
return (string) $val;
}
return $this->notORM->connection->quote($val);
}

/** Insert row in a table
Expand Down Expand Up @@ -537,7 +540,7 @@ function sum($column) {
return $this->aggregation("SUM($column)");
}

/** Execute built query
/** Execute the built query
* @return null
*/
protected function execute() {
Expand Down

0 comments on commit c4cd8bd

Please sign in to comment.