Skip to content

Commit

Permalink
All tests pass in Sqlite now, additionally made more secure the way
Browse files Browse the repository at this point in the history
DateDiff is translated
  • Loading branch information
lorenzo committed Aug 13, 2013
1 parent 32983dc commit e043699
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Database/Dialect/SqliteDialectTrait.php
Expand Up @@ -71,7 +71,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression)
->name('ROUND')
->type('-')
->iterateParts(function($p) {
return new FunctionExpression('JULIANDAY', [$p => 'literal']);
return new FunctionExpression('JULIANDAY', [$p['value']], [$p['type']]);
});
break;
case 'NOW':
Expand Down
8 changes: 7 additions & 1 deletion lib/Cake/Database/Expression/FunctionExpression.php
Expand Up @@ -65,6 +65,13 @@ public function __construct($name, $params = [], $types = []) {
parent::__construct($params, $types, ',');
}

/**
* Sets the name of the SQL function to be invoke in this expression,
* if no value is passed it will return current name
*
* @param string $name
* @return string
*/
public function name($name = null) {
if ($name === null) {
return $this->_name;
Expand Down Expand Up @@ -112,7 +119,6 @@ public function add($params, $types = []) {
* @return string
*/
public function sql(ValueBinder $generator) {

$parts = [];
foreach ($this->_conditions as $condition) {
if ($condition instanceof ExpressionInterface) {
Expand Down

0 comments on commit e043699

Please sign in to comment.