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 untrusted user: 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 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS "queries-episodes-${constants.database}.tpl.html" %-->
<article> <article>
<header> <header>
<h1>Complete Archive of Shows.</h1> <h1>Complete Archive of Shows.</h1>
@ -7,21 +8,7 @@
</p> </p>
</header> </header>
<!--% USE DBI(constants.driver, constants.user, constants.password) %--> <!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% FOREACH episodes IN DBI.query(' <!--% FOREACH episodes IN DBI.query(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
')
%--> %-->
<!--% show_summary(episodes) %--> <!--% show_summary(episodes) %-->
<!--% END %--> <!--% 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'
%-->