[Phphtmllib-devel] SF.net SVN: phphtmllib:[3185] trunk/open2300/lib/modules/api/RemoteUpdate. inc
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2008-11-07 06:54:47
|
Revision: 3185 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3185&view=rev Author: hemna Date: 2008-11-07 06:54:42 +0000 (Fri, 07 Nov 2008) Log Message: ----------- make sure we trap the non dupe not found exception Modified Paths: -------------- trunk/open2300/lib/modules/api/RemoteUpdate.inc Modified: trunk/open2300/lib/modules/api/RemoteUpdate.inc =================================================================== --- trunk/open2300/lib/modules/api/RemoteUpdate.inc 2008-11-07 06:43:45 UTC (rev 3184) +++ trunk/open2300/lib/modules/api/RemoteUpdate.inc 2008-11-07 06:54:42 UTC (rev 3185) @@ -19,12 +19,22 @@ //in the db $datetime = $r->get('datetime'); if (!is_null($datetime)) { - $wx = weatherDataObject::find("datetime = :time", array(":time"=> $datetime)); - $GLOBALS['log']->debug('RemoteUpdate -- Dupe.'); - return "Duplicate"; + try { + $wx = weatherDataObject::find("datetime = :time", array(":time"=> $datetime)); + $GLOBALS['log']->debug('RemoteUpdate -- Dupe.'); + return "Duplicate"; + } catch (Exception $ex) { + //probably a not found + if ($ex->getCode() != phphtmllibException::DBDATAOBJECT_FIND_NOT_FOUND) { + throw $ex; + } else{ + //we didn't find it, so lets insert it. + $wx = new weatherDataObject(); + } + } } - $wx = new weatherDataObject(); + $meta = $wx->get_meta_data(); foreach($meta as $key => $val) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |