FIX bad syntax of ORDER BY.

This fixes the way the ORDER BY option is passed to the Database::select()
function. This was previously done wrong in some places, rendering the
ORDER BY clause ineffective.

The bad ORDER BY could potentially lead to confusion when iterating over
large sets of data. This may be the/a cause of changes "ocasionally" not
being dispatched.

Change-Id: I2e607f968232edd8d089c3566e919c193d4f3387
Merge "FIX bad syntax of ORDER BY."