"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Database/QueryCompiler.php" between
cakephp-4.0.1.tar.gz and cakephp-4.0.2.tar.gz

About: CakePHP is a rapid development framework for PHP applications. Source code.

QueryCompiler.php  (cakephp-4.0.1):QueryCompiler.php  (cakephp-4.0.2)
skipping to change at line 130 skipping to change at line 130
* Returns a callable object that can be used to compile a SQL string repres entation * Returns a callable object that can be used to compile a SQL string repres entation
* of this query. * of this query.
* *
* @param string $sql initial sql string to append to * @param string $sql initial sql string to append to
* @param \Cake\Database\Query $query The query that is being compiled * @param \Cake\Database\Query $query The query that is being compiled
* @param \Cake\Database\ValueBinder $generator The placeholder and value bi nder object * @param \Cake\Database\ValueBinder $generator The placeholder and value bi nder object
* @return \Closure * @return \Closure
*/ */
protected function _sqlCompiler(string &$sql, Query $query, ValueBinder $gen erator): Closure protected function _sqlCompiler(string &$sql, Query $query, ValueBinder $gen erator): Closure
{ {
return function ($parts, $name) use (&$sql, $query, $generator): ?string { return function ($part, $partName) use (&$sql, $query, $generator) {
if ( if (
!isset($parts) || $part === null ||
( (is_array($part) && empty($part)) ||
( ($part instanceof Countable && count($part) === 0)
is_array($parts) ||
$parts instanceof Countable
) &&
!count($parts)
)
) { ) {
return null; return;
} }
if ($parts instanceof ExpressionInterface) {
$parts = [$parts->sql($generator)]; if ($part instanceof ExpressionInterface) {
$part = [$part->sql($generator)];
} }
if (isset($this->_templates[$name])) { if (isset($this->_templates[$partName])) {
$parts = $this->_stringifyExpressions((array)$parts, $generator) $part = $this->_stringifyExpressions((array)$part, $generator);
; $sql .= sprintf($this->_templates[$partName], implode(', ', $par
t));
return $sql .= sprintf($this->_templates[$name], implode(', ', $ parts)); return;
} }
return $sql .= $this->{'_build' . ucfirst($name) . 'Part'}($parts, $ query, $generator); $sql .= $this->{'_build' . $partName . 'Part'}($part, $query, $gener ator);
}; };
} }
/** /**
* Helper function used to build the string representation of a SELECT claus e, * Helper function used to build the string representation of a SELECT claus e,
* it constructs the field list taking care of aliasing and * it constructs the field list taking care of aliasing and
* converting expression objects to string. This function also constructs th e * converting expression objects to string. This function also constructs th e
* DISTINCT clause for the query. * DISTINCT clause for the query.
* *
* @param array $parts list of fields to be transformed to string * @param array $parts list of fields to be transformed to string
 End of changes. 7 change blocks. 
17 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)