Files
dashlibstorage/src/providers/sqlite3/queries/pic.js
2026-10-09 18:26:01 +02:00

37 lines
856 B
JavaScript

import * as source from '../../mssql/queries/pic.js';
import { translateQueries } from './translate.js';
const queries = translateQueries(source, 'pic');
export const {
GET_CATEGORY_ID_BY_HASH,
} = queries;
export const CREATE = `
INSERT INTO pic (
w, h, size, hash, thumbw, thumbh, thumbhash,
smallthumbw, smallthumbh, smallthumbbinary, source
)
VALUES (
@w, @h, @size, @hash, @thumbw, @thumbh, @thumbhash,
@smallthumbw, @smallthumbh, @smallthumbbinary, @source
)
RETURNING id
`;
export const GET_FULL_BY_HASH = `
SELECT w, h, size, hash
FROM pic
WHERE hash = @hash
`;
export const GET_THUMB_BY_HASH = `
SELECT thumbw AS w, thumbh AS h, hash
FROM pic
WHERE hash = @hash
`;
export const DELETE_BY_ARTICLE_AND_HASH = `
DELETE FROM pic
WHERE hash = @fullHash
AND id IN (SELECT pic_id FROM articlepic WHERE article_id = @articleId)
`;