throw exception if we get unexpected numbers of results in cc_pref
This commit is contained in:
parent
aa564434dd
commit
ad82b4ff98
1 changed files with 6 additions and 2 deletions
|
@ -38,7 +38,11 @@ class Application_Model_Preference
|
|||
$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, 'column');
|
||||
|
||||
$paramMap = array();
|
||||
if ($result == 1) {
|
||||
if ($result > 1) {
|
||||
//this case should not happen.
|
||||
throw new Exception("Invalid number of results returned. Should be ".
|
||||
"0 or 1, but is '$result' instead");
|
||||
} elseif ($result == 1) {
|
||||
// result found
|
||||
if (is_null($id) || !$isUserValue) {
|
||||
// system pref
|
||||
|
@ -80,7 +84,7 @@ class Application_Model_Preference
|
|||
|
||||
} catch (Exception $e) {
|
||||
header('HTTP/1.0 503 Service Unavailable');
|
||||
Logging::info("Could not connect to database: ".$e->getMessage());
|
||||
Logging::info("Database error: ".$e->getMessage());
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue