Fix column name, check for error from DB
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 18 Aug 2009 16:17:18 +0000 (12:17 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 29 Sep 2009 20:53:48 +0000 (16:53 -0400)
kronolith/lib/Driver/Sql.php

index 000d141..8e77e7e 100644 (file)
@@ -798,9 +798,12 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
 
     public function getResource($id)
     {
-        $query = 'SELECT resource_id, resource_name, resource_calendar, resource_category FROM kronolith_resources WHERE resource_uid = ?';
+        $query = 'SELECT resource_id, resource_name, resource_calendar, resource_category FROM kronolith_resources WHERE resource_id = ?';
 
         $results = $this->_db->getRow($query, array($id), DB_FETCHMODE_ASSOC);
+        if ($results instanceof PEAR_Error) {
+            throw new Horde_Exception($results->getMessage());
+        }
         $return = array();
         foreach ($results as $field => $value) {
             $return[str_replace('resource_', '', $field)] = $this->convertFromDriver($value);