Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/xPDO/Om/xPDOQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ abstract class xPDOQuery extends xPDOCriteria {
protected $_class= null;
protected $_alias= null;
protected $_tableClass = null;
protected $errors = [];
public $graph= array ();
public $query= array (
'command' => 'SELECT',
Expand Down Expand Up @@ -663,6 +664,10 @@ public function prepare($bindings= array (), $byValue= true, $cacheFlag= null) {
} else {
$this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Could not construct or prepare query because it is invalid or could not connect: ' . $this->sql);
}
if (!empty($this->errors)) {
$this->xpdo->log(xPDO::LOG_LEVEL_ERROR, implode("\r\n", $this->errors) . "\r\nQuery: " . $this->sql);
}

return $this->stmt;
}

Expand Down Expand Up @@ -776,7 +781,7 @@ public function parseConditions($conditions, $conjunction = xPDOQuery::SQL_AND)
}
}
if (empty($vals)) {
$this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Encountered empty {$operator} condition with key {$key}");
$this->errors[] = "Encountered empty {$operator} condition with key {$key}.";
}
$val = "(" . implode(',', $vals) . ")";
$sql = "{$this->xpdo->escape($alias)}.{$this->xpdo->escape($key)} {$operator} {$val}";
Expand Down