Fix syntax error in SQL to purge mediacache entries.
Fix missing terminators on SQL to delete settings rows.
Fix missing sqlite3_reset calls in DB template utility functions.