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。