Permalink
Browse files

[#4523] Log SQL errors in xPDOObject::loadCollectionGraph()

  • Loading branch information...
opengeek committed Nov 29, 2011
1 parent f4c95dd commit a2a5bcb56dc6ad4fcd29ee885bde9fed41919f6e
Showing with 9 additions and 3 deletions.
  1. +1 −0 xpdo/changelog.txt
  2. +8 −3 xpdo/om/xpdoobject.class.php
View
@@ -1,5 +1,6 @@
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
- [#6098] Fix issue with preg_replace in xPDO::parseBindings() method
- [#5970] Fix issue with subpackages and derived classes that would cause nonsensical error
@@ -529,9 +529,14 @@ public static function loadCollectionGraph(xPDO & $xpdo, $className, $graph, $cr
$fromCache = !empty($rows);
}
if (!$fromCache) {
- $stmt= $query->prepare();
- if ($stmt && $stmt->execute()) {
- $objCollection= $query->hydrateGraph($stmt, $cacheFlag);
+ if ($query->prepare()) {
+ if ($query->stmt->execute()) {
+ $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)) {
$objCollection= $query->hydrateGraph($rows, $cacheFlag);

0 comments on commit a2a5bcb

Please sign in to comment.