[OGo-Developer] Paranoid check in DirectAction+Resource?

Helge Hess developer@opengroupware.org
Mon, 2 Oct 2006 16:41:40 +0200


On Oct 2, 2006, at 16:17, Adam Tauno Williams wrote:
> I noticed in DirectAction
> +Resource.m/_dictionaryForResourceEOGenericRecord this bit of code:
> --------------------------------------
> results = [ctx runCommand:@"appointmentresource::get-by-globalid",
>                @"gid", gid,
>                nil];
> if ((rLength = [results count]) == 0) {
>   [self logWithFormat:@"No result found, but global ID is valid"];
>   return nil;
> }
> if (rLength >= 2) {
>   [self logWithFormat:@"Too many results for one global ID found"];
>   return nil;
> }
> --------------------------------------
>
> Is the "rLength >= 2" check generally necessary?  I thought that a
> request by gid would return one object or none?  In what circumstances
> can a request by gid return two or more objects?  (I get the  
> difference
> between using the key "gid" and "gids").

I think this is just a safeguard and not strictly necessary.

Greets,
   Helge
-- 
Helge Hess
http://docs.opengroupware.org/Members/helge/