launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #08969
Re: Displaying work items in the correct order
On 16/02/12 00:12, Robert Collins wrote:
> You could use a list (e.g. rather than sequence, have a next pointer
> pointing at the id of the next WI; you'd only need to update 2 rows to
> do an in-middle insert.
Oh, of course, maybe I'd have thought of that if I hadn't constrained
myself to the existing DB schema.
>
> OTOH updating a dozen is one sql statement (done carefully) and will be fast.
>
Is there a way to update values in multiple rows without using a fixed
function applied on the existing value of all rows? (e.g. we might need
to add 1 to the sequence of one row and 2 to the sequence of another)?
I guess I could do something like "i+1 if i<5; i+2 if i>=5" but that
doesn't sound nice as we'd have to figure out the equation on every update.
There's also the chance that the user updated the
status/assignee/milestone of one of those rows, which would make the
code even more complicated if we wanted to batch it as well (can we even
do it?), so it's starting to feel like the best alternative is to
actually keep the code simple and let it issue as many updates as
necessary, which won't be that many even when all rows are changed.
> KISS IMO.
--
Guilherme Salgado <https://launchpad.net/~salgado>
Attachment:
signature.asc
Description: OpenPGP digital signature
Follow ups
References