Archived
4
2

Refactor MySQL database specific SQL

This commit is contained in:
Roan Horning 2022-11-27 14:04:12 -05:00
parent 6f28bb2a16
commit 675f8fa9d5
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769
2 changed files with 17 additions and 15 deletions

View File

@ -1,4 +1,5 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS "queries-episodes-${constants.database}.tpl.html" %-->
<article>
<header>
<h1>Complete Archive of Shows.</h1>
@ -7,21 +8,7 @@
</p>
</header>
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% FOREACH episodes IN DBI.query('
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_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC
')
<!--% FOREACH episodes IN DBI.query(query_episodes)
%-->
<!--% show_summary(episodes) %-->
<!--% END %-->

View 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_ADD(NOW(), INTERVAL 1 DAY)
ORDER BY eps.id DESC'
%-->