Added const qualifiers and null checks to db functions
The patterns_file_blob_index didn't actually load an index
Added a flush for sanity
Formatting changes
Added patterns_file_is_modified