[dev] Major flaw in DataTree::getLast() implementation

Jan Schneider jan at horde.org
Thu May 26 05:23:37 PDT 2005


Zitat von Jan Schneider <jan at horde.org>:

> It took me a while to find this out, but it's easy to reproduce: simply
> start a new thread in Agora and return to the forums listing directly
> after that.
>
> DataTree::getLast() assumes that the last object in a tree branch is
> the one with the highest ID. But that's wrong because in add() we
> *first* retrieve a new sequence ID and *then* check if we already have
> a parent object and create it if not (retrieving another, higher
> sequence ID). This logic could probably be changed in add(), but it
> exists since ever, so getLast() won't work with any old DataTree data,
> which is a bad thing IMO.
>
> Any ideas how to proceed?

We could use the yet unused datatree_updated column, but does an unused 
timstamp column behave the same in all databases, i.e. is it 
automatically set to the current timestamp?

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list