This commit is contained in:
seb
2026-08-01 01:36:49 +02:00
parent 243143e7eb
commit 671064bf3f
9 changed files with 181 additions and 5 deletions

View File

@@ -1,9 +1,29 @@
export const CREATE = `
INSERT INTO pic (
w, h, size, hash, thumbw, thumbh, thumbhash, source, [binary], thumbbinary
w, h, size, hash, thumbw, thumbh, thumbhash, source, fullbinary, thumbbinary
)
OUTPUT INSERTED.id
VALUES (
@w, @h, @size, @hash, @thumbw, @thumbh, @thumbhash, @source, @binary, @thumbbinary
@w, @h, @size, @hash, @thumbw, @thumbh, @thumbhash, @source, @fullbinary, @thumbbinary
)
`;
export const GET_CATEGORY_ID_BY_HASH = `
SELECT TOP 1 ca.category_id AS categoryId
FROM pic p
INNER JOIN articlepic ap ON ap.pic_id = p.id
INNER JOIN categoryarticle ca ON ca.article_id = ap.article_id
WHERE p.hash = @hash
`;
export const GET_FULL_BY_HASH = `
SELECT w, h, size, fullbinary AS buffer
FROM pic
WHERE hash = @hash
`;
export const GET_THUMB_BY_HASH = `
SELECT thumbw AS w, thumbh AS h, thumbbinary AS buffer
FROM pic
WHERE hash = @hash
`;