Make sure all queries are initialized on our database object.

Since we use a database with the non default name, we need to do that,
otherwise the query is initialized on the default db which is not open
in our case.
Handle changing source file in upload correctly.

Delete the file on the server if the source file is new, but
the source did not arrive completely within a timespan.