Skip to content

Commit

Permalink
[#4523] Log SQL errors in xPDOObject::loadCollectionGraph()
Browse files Browse the repository at this point in the history
  • Loading branch information
opengeek committed Nov 29, 2011
1 parent f4c95dd commit a2a5bcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions xpdo/changelog.txt
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,6 @@
This file shows the changes in this release of xPDO. This file shows the changes in this release of xPDO.


- [#4523] Log SQL errors in xPDOObject::loadCollectionGraph
- [#6095] Log errors when xPDOManager::addField/alterField fail - [#6095] Log errors when xPDOManager::addField/alterField fail
- [#6098] Fix issue with preg_replace in xPDO::parseBindings() method - [#6098] Fix issue with preg_replace in xPDO::parseBindings() method
- [#5970] Fix issue with subpackages and derived classes that would cause nonsensical error - [#5970] Fix issue with subpackages and derived classes that would cause nonsensical error
Expand Down
11 changes: 8 additions & 3 deletions xpdo/om/xpdoobject.class.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -529,9 +529,14 @@ public static function loadCollectionGraph(xPDO & $xpdo, $className, $graph, $cr
$fromCache = !empty($rows); $fromCache = !empty($rows);
} }
if (!$fromCache) { if (!$fromCache) {
$stmt= $query->prepare(); if ($query->prepare()) {
if ($stmt && $stmt->execute()) { if ($query->stmt->execute()) {
$objCollection= $query->hydrateGraph($stmt, $cacheFlag); $objCollection= $query->hydrateGraph($query->stmt, $cacheFlag);
} else {
$xpdo->log(xPDO::LOG_LEVEL_ERROR, "Error {$query->stmt->errorCode()} executing query: {$query->sql} - " . print_r($query->stmt->errorInfo(), true));
}
} else {
$xpdo->log(xPDO::LOG_LEVEL_ERROR, "Error {$xpdo->errorCode()} preparing statement: {$query->sql} - " . print_r($xpdo->errorInfo(), true));
} }
} elseif (!empty($rows)) { } elseif (!empty($rows)) {
$objCollection= $query->hydrateGraph($rows, $cacheFlag); $objCollection= $query->hydrateGraph($rows, $cacheFlag);
Expand Down

0 comments on commit a2a5bcb

Please sign in to comment.