Create a new temp table for style items to be inserted into history.

This is only to get a proper ROWNUM (not supported by SQLite) for the
select results.
Fix order of style items recorded into the style and when applied to image.
Merge branch 'fix-multi-prio-in-style'

* fix-multi-prio-in-style:
  Fix order of style items recorded into the style and when applied to image.
  Create a new temp table for style items to be inserted into history.