mirror of
https://github.com/processwire/processwire.git
synced 2025-08-17 20:11:46 +02:00
Attempt fix for issue processwire/processwire-issues#1198
This commit is contained in:
@@ -624,7 +624,7 @@ abstract class DatabaseQuery extends WireData {
|
|||||||
/**
|
/**
|
||||||
* Return the generated SQL for specific query method
|
* Return the generated SQL for specific query method
|
||||||
*
|
*
|
||||||
* @param string $method Specify method name to get SQL for
|
* @param string $method Specify method name to get SQL for, or blank string for entire query
|
||||||
* @return string
|
* @return string
|
||||||
* @since 3.0.157
|
* @since 3.0.157
|
||||||
*
|
*
|
||||||
@@ -633,13 +633,19 @@ abstract class DatabaseQuery extends WireData {
|
|||||||
|
|
||||||
if(!$method) return $this->getQuery();
|
if(!$method) return $this->getQuery();
|
||||||
if(!isset($this->queryMethods[$method])) return '';
|
if(!isset($this->queryMethods[$method])) return '';
|
||||||
$methodName = 'getQuery' . ucfirst($method);
|
|
||||||
if(method_exists($this, $methodName)) return $this->$methodName();
|
|
||||||
|
|
||||||
list($prepend, $split, $append) = $this->queryMethods[$method];
|
$methodName = 'getQuery' . ucfirst($method);
|
||||||
$values = $this->$method;
|
|
||||||
if(!is_array($values) || !count($values)) return '';
|
if(method_exists($this, $methodName)) {
|
||||||
$sql = $prepend . implode($split, $values) . $append;
|
$sql = $this->$methodName();
|
||||||
|
} else {
|
||||||
|
list($prepend, $split, $append) = $this->queryMethods[$method];
|
||||||
|
$values = $this->$method;
|
||||||
|
if(!is_array($values) || !count($values)) return '';
|
||||||
|
$sql = trim(implode($split, $values));
|
||||||
|
if(!strlen($sql) || $sql === trim($split)) return '';
|
||||||
|
$sql = $prepend . $sql . $append;
|
||||||
|
}
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user