Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hjyssg opened this issue Mar 19, 2023 · 0 comments
Open

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

hjyssg opened this issue Mar 19, 2023 · 0 comments
Labels

Comments

@hjyssg
Copy link
Owner

hjyssg commented Mar 19, 2023

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

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。

@hjyssg hjyssg added the note label Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant