hjyssg / ShiguReader

硬核宅宅资源管理器. Ultimate Manga Resource Manager
MIT License
401 stars 45 forks source link

thumbnail db是可以join的,但是... #210

Open hjyssg opened 1 year ago

hjyssg commented 1 year ago

从后端的角度,其实更好的写法是

let thumbnail_db_path = path.join(rootPath, userConfig.workspace_name, "thumbnail_sql_db");

module.exports.init = async ()=> {
    ...
    await sqlDb.runSync(`ATTACH DATABASE '${thumbnail_db_path}' as 'THUMB_DB'`);

然后

SELECT AA.*, BB.thumbnailFileName
            FROM  (SELECT filePath FROM ${tempFileTable} WHERE dirPath = ? ) AA LEFT JOIN THUMB_DB.thumbnail_table BB
            ON AA.filePath = BB.filePath

但是现在内部业务逻辑比较复杂了。 内部现在都是用{ }来缓存thumbnail信息。没必要为了代码好看,费时费力把所有sql都去改成join。