Various addon/repository improvements, mostly efficiency

Quite a few commits here, aimed at speeding up repository processing.

The main gain is the dependency speedup on my machine (passing the database object into the function) - I have an SSD though, so it may be different on other machines.

The next largest gain is the broken status updating (the addition of Begin/CommitMultipleExecute and calling that from CRepository::DoWork()), as well as the addition of GetAddonVersion().

The rest allows reduced queries, in particular by utilizing a custom collator within SQLite to ensure that sorting by version works as you'd expect.  This is not implemented for mysql, but that's OK as the addons database is SQL-only anyway.  I'm sure there's a version that could be done for mysql as well though.  Note that it doesn't offer anything much in the way of speedup, so we could drop the four commits implementing this if it doesn't offer much in the way of speedup for others.

There is a possibility to perform GetAddon() single query via
```
SELECT * FROM addon WHERE id=(SELECT id FROM addon WHERE addonID='my.addon.id' ORDER BY version DESC LIMIT 1)
```
but this didn't seem to be any faster.  Any ideas for improvement most welcome!

(One thing we could consider post-Gotham is just storing the highest version in the database anyway.  I'm not sure what the implications here are though - some thought would be needed to make sure we get this right, particularly in regard to the linking of repository and addons)

Lastly, I've included some timing logs for @MartijnKaijser to test with.