Add more checking to handle MySQL strict mode

I just tested this against a server which has strict mode enabled and it failed to detect files which exist because it errored with either wrong data type or insufficient space when trying to insert the file into the table. I've added checks for those two errors and it is now detecting files again.