The fid is of type SERIAL, which is an AUTO INCREMENT type.
The fid is also of type NOT NULL.
The current code tries to push NULL, which is invalid among some SQL databases.
Therefore, allow the database to AUTO INCREMENT the value.

--- bitcache.module.orig	2009-05-08 13:32:07.000000000 -0500
+++ bitcache.module	2009-05-08 13:32:22.000000000 -0500
@@ -855,7 +855,7 @@
 function bitcache_tmpname($register = TRUE) {
   if (($path = tempnam(file_directory_temp(), 'drupal_bitcache_')) && $register) {
     global $user;
-    db_query("INSERT INTO {files} (fid, uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (NULL, %d, '%s', '%s', '%s', 0, %d, %d)", $user->uid, basename($path), $path, 'application/octet-stream', FILE_STATUS_TEMPORARY, time());
+    db_query("INSERT INTO {files} (uid, filename, filepath, filemime, filesize, status, timestamp) VALUES (%d, '%s', '%s', '%s', 0, %d, %d)", $user->uid, basename($path), $path, 'application/octet-stream', FILE_STATUS_TEMPORARY, time());
   }
   return $path;
 }
