Commit 650bdb3af2eec7c9cb168f2e30e21ebb350882c5
1 parent
3d22e180
Give the ID used for a lookup in our error messages, and catch a
potential error that may be returned by a query. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3607 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
5 additions
and
2 deletions
lib/ktentity.inc
| @@ -119,10 +119,10 @@ class KTEntity { | @@ -119,10 +119,10 @@ class KTEntity { | ||
| 119 | return $res; | 119 | return $res; |
| 120 | } | 120 | } |
| 121 | if (count($res) === 0) { | 121 | if (count($res) === 0) { |
| 122 | - return PEAR::raiseError("No such ID"); | 122 | + return PEAR::raiseError("No such ID: $iId"); |
| 123 | } | 123 | } |
| 124 | if (count($res) > 1) { | 124 | if (count($res) > 1) { |
| 125 | - return PEAR::raiseError("Multiple matches for ID"); | 125 | + return PEAR::raiseError("Multiple matches for ID: $iID"); |
| 126 | } | 126 | } |
| 127 | $vk = array_flip($this->_aFieldToSelect); | 127 | $vk = array_flip($this->_aFieldToSelect); |
| 128 | $aLoadInfo = array(); | 128 | $aLoadInfo = array(); |
| @@ -262,6 +262,9 @@ class KTEntityUtil { | @@ -262,6 +262,9 @@ class KTEntityUtil { | ||
| 262 | $sQuery .= " ORDER BY " . $sOrderBy; | 262 | $sQuery .= " ORDER BY " . $sOrderBy; |
| 263 | } | 263 | } |
| 264 | $aIDs = DBUtil::getResultArrayKey(array($sQuery, $aParams), $sIDField); | 264 | $aIDs = DBUtil::getResultArrayKey(array($sQuery, $aParams), $sIDField); |
| 265 | + if (PEAR::isError($aIDs)) { | ||
| 266 | + return $aIDs; | ||
| 267 | + } | ||
| 265 | 268 | ||
| 266 | if ($bIDs === true) { | 269 | if ($bIDs === true) { |
| 267 | return $aIDs; | 270 | return $aIDs; |