Add SQLite specific query templates
This commit is contained in:
parent
71a63e1beb
commit
2a486cb58b
18
templates/queries-correspondent-sqlite.tpl.html
Normal file
18
templates/queries-correspondent-sqlite.tpl.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!--% query_hpr_shows = '
|
||||||
|
SELECT
|
||||||
|
eps.id,
|
||||||
|
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit ,
|
||||||
|
eps.date, eps.license, eps.duration,
|
||||||
|
eps.title, eps.summary, eps.tags,
|
||||||
|
eps.notes,
|
||||||
|
hosts.local_image,
|
||||||
|
hosts.hostid,
|
||||||
|
hosts.host, hosts.email,
|
||||||
|
miniseries.name AS series, miniseries.id AS seriesid
|
||||||
|
FROM eps
|
||||||
|
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||||
|
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||||
|
WHERE hosts.hostid = ? AND eps.date < date(\'now\', \'+1 days\')
|
||||||
|
ORDER BY eps.id + 0 DESC
|
||||||
|
'
|
||||||
|
%-->
|
51
templates/queries-episode-sqlite.tpl.html
Normal file
51
templates/queries-episode-sqlite.tpl.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<!--% query_episode_maxmin = '
|
||||||
|
WITH episode_maxmin AS (
|
||||||
|
SELECT MAX(id) AS \'latest\', MIN(id) AS \'earliest\', ? AS \'id\'
|
||||||
|
FROM eps
|
||||||
|
WHERE eps.date < date(\'now\', \'+1 days\')
|
||||||
|
),
|
||||||
|
episode_date AS (
|
||||||
|
SELECT eps.date
|
||||||
|
FROM eps
|
||||||
|
WHERE eps.id = ?
|
||||||
|
),
|
||||||
|
episode_previous AS (
|
||||||
|
SELECT MAX(id) AS \'previous\', ? AS \'id\'
|
||||||
|
FROM eps
|
||||||
|
INNER JOIN episode_date
|
||||||
|
ON eps.date < episode_date.date
|
||||||
|
WHERE eps.id > 1
|
||||||
|
),
|
||||||
|
episode_next AS (
|
||||||
|
SELECT MIN(id) AS \'next\', ? AS \'id\'
|
||||||
|
FROM eps
|
||||||
|
INNER JOIN episode_date
|
||||||
|
ON eps.date > episode_date.date
|
||||||
|
WHERE eps.date < date(\'now\')
|
||||||
|
),
|
||||||
|
comment_tallies AS (
|
||||||
|
SELECT
|
||||||
|
eps_id,
|
||||||
|
COUNT(eps_id) AS eps_tally
|
||||||
|
FROM comments
|
||||||
|
GROUP BY eps_id
|
||||||
|
)
|
||||||
|
SELECT eps.id, eps.date, eps.title, eps.duration,
|
||||||
|
eps.summary, eps.notes, eps.explicit, eps.license,
|
||||||
|
eps.tags, eps.version, eps.downloads, eps.valid,
|
||||||
|
episode_maxmin.latest, episode_maxmin.earliest,
|
||||||
|
episode_previous.previous, episode_next.next,
|
||||||
|
hosts.hostid, hosts.host,
|
||||||
|
miniseries.name AS \'series\', miniseries.id AS \'seriesid\',
|
||||||
|
miniseries.description AS \'series_description\',
|
||||||
|
COALESCE (comment_tallies.eps_tally, 0) AS eps_tally
|
||||||
|
FROM eps
|
||||||
|
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||||
|
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||||
|
INNER JOIN episode_maxmin ON eps.id = episode_maxmin.id
|
||||||
|
INNER JOIN episode_previous ON eps.id = episode_previous.id
|
||||||
|
INNER JOIN episode_next ON eps.id = episode_next.id
|
||||||
|
LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
|
||||||
|
WHERE eps.id = ?
|
||||||
|
'
|
||||||
|
%-->
|
15
templates/queries-episodes-sqlite.tpl.html
Normal file
15
templates/queries-episodes-sqlite.tpl.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!--% query_episodes = 'SELECT
|
||||||
|
eps.id,
|
||||||
|
eps.explicit,
|
||||||
|
eps.date, eps.license, eps.title, eps.summary,
|
||||||
|
eps.duration, eps.notes, eps.tags,
|
||||||
|
hosts.hostid,
|
||||||
|
hosts.host, hosts.email, hosts.local_image,
|
||||||
|
miniseries.name AS series, miniseries.id AS seriesid
|
||||||
|
FROM eps
|
||||||
|
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||||
|
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||||
|
WHERE eps.date < date(\'now\', \'+1 days\')
|
||||||
|
ORDER BY eps.id + 0 DESC'
|
||||||
|
%-->
|
||||||
|
|
4
templates/queries-ids-episode-sqlite.tpl.html
Normal file
4
templates/queries-ids-episode-sqlite.tpl.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<!--% query_ids_episode = 'select eps.id from eps
|
||||||
|
where eps.date < date(\'now\', \'+1 days\')'
|
||||||
|
%-->
|
||||||
|
|
62
templates/queries-index-sqlite.tpl.html
Normal file
62
templates/queries-index-sqlite.tpl.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!--% query_next_available_episode = '
|
||||||
|
WITH next_id AS (
|
||||||
|
SELECT id, id + 1 AS \'id_next\', date as \'last_date\'
|
||||||
|
FROM eps
|
||||||
|
WHERE eps.date > date(\'now\')
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
MIN(next_id.id_next) AS \'next_id\',
|
||||||
|
strftime(\'%Y\', MIN (last_date)) AS \'last_year\',
|
||||||
|
strftime(\'%d\', MIN (last_date)) AS \'last_day\',
|
||||||
|
strftime(\'%m\', MIN (last_date)) AS \'last_month\'
|
||||||
|
FROM next_id
|
||||||
|
LEFT JOIN eps ON next_id.id_next = eps.id
|
||||||
|
WHERE eps.id IS NULL
|
||||||
|
'
|
||||||
|
%-->
|
||||||
|
<!--% query_latest_episodes = '
|
||||||
|
WITH comment_tallies AS (
|
||||||
|
SELECT
|
||||||
|
eps_id,
|
||||||
|
COUNT(eps_id) AS eps_tally
|
||||||
|
FROM comments
|
||||||
|
GROUP BY eps_id
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
eps.id,
|
||||||
|
eps.explicit,
|
||||||
|
eps.date, eps.license, eps.duration,
|
||||||
|
eps.title, eps.summary, eps.tags,
|
||||||
|
eps.notes,
|
||||||
|
hosts.local_image,
|
||||||
|
hosts.hostid,
|
||||||
|
hosts.host, hosts.email,
|
||||||
|
miniseries.name AS series, miniseries.id AS seriesid,
|
||||||
|
COALESCE (comment_tallies.eps_tally, 0) AS eps_tally
|
||||||
|
FROM eps
|
||||||
|
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||||
|
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||||
|
LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
|
||||||
|
WHERE eps.date < date(\'now\', \'+1 days\')
|
||||||
|
ORDER BY eps.id + 0 DESC
|
||||||
|
LIMIT 10
|
||||||
|
'
|
||||||
|
%-->
|
||||||
|
<!--% query_last_5_weeks_episodes = '
|
||||||
|
SELECT
|
||||||
|
eps.id,
|
||||||
|
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit ,
|
||||||
|
eps.date, eps.license, eps.title, eps.summary,
|
||||||
|
eps.duration, eps.notes, eps.tags,
|
||||||
|
hosts.hostid,
|
||||||
|
hosts.host, hosts.email, hosts.local_image,
|
||||||
|
miniseries.name AS series, miniseries.id AS seriesid
|
||||||
|
FROM eps
|
||||||
|
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||||
|
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||||
|
WHERE eps.date < date(\'now\', \'+1 days\')
|
||||||
|
ORDER BY eps.id + 0 DESC
|
||||||
|
LIMIT 30 OFFSET 10
|
||||||
|
'
|
||||||
|
%-->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user