sqlite
This commit is contained in:
@@ -3,9 +3,31 @@ import { translateQueries } from './translate.js';
|
||||
|
||||
const queries = translateQueries(source, 'pic');
|
||||
export const {
|
||||
CREATE, GET_CATEGORY_ID_BY_HASH, GET_FULL_BY_HASH, GET_THUMB_BY_HASH,
|
||||
GET_CATEGORY_ID_BY_HASH,
|
||||
} = queries;
|
||||
|
||||
export const CREATE = `
|
||||
INSERT INTO pic (
|
||||
w, h, size, hash, thumbw, thumbh, thumbhash, source
|
||||
)
|
||||
VALUES (
|
||||
@w, @h, @size, @hash, @thumbw, @thumbh, @thumbhash, @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
|
||||
|
||||
Reference in New Issue
Block a user