Reimplemented QOS checking.

I'm so sorry.  I forgot this was not enabled when I did the backend
fixes.  Not having QOS resulted in a lot of malformed data, as the QOS
handled conversion changes from SQL to Lua, and from SQLite <--> MySQL.
I think all data issues are now fixed.