fixed SQL a bit, insertion of new files/metadata seems to work now, as does querying for metadata