Add --quick option to fb scan ...

This commit is contained in:
Bryan Ashby 2018-02-16 23:00:15 -07:00
parent cd51cc1adb
commit 9ad38f84a7
2 changed files with 134 additions and 23 deletions

View file

@ -221,6 +221,19 @@ module.exports = class FileEntry {
return paths.join(storageDir, this.fileName);
}
static quickCheckExistsByPath(fullPath, cb) {
fileDb.get(
`SELECT COUNT() AS count
FROM file
WHERE file_name = ?
LIMIT 1;`,
[ paths.basename(fullPath) ],
(err, rows) => {
return err ? cb(err) : cb(null, rows.count > 0 ? true : false);
}
);
}
static persistUserRating(fileId, userId, rating, cb) {
return fileDb.run(
`REPLACE INTO file_user_rating (file_id, user_id, rating)