Refactor MySQL database specific SQL
This commit is contained in:
parent
3cc6da57ad
commit
1312e3d374
@ -1,6 +1,7 @@
|
||||
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-avatar.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS "queries-correspondent-${constants.database}.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
||||
<!--% query_hpr_show_count = DBI.prepare('
|
||||
SELECT id
|
||||
@ -8,26 +9,10 @@
|
||||
WHERE eps.hostid = ?
|
||||
')
|
||||
%-->
|
||||
<!--% query_hpr_shows = DBI.prepare('
|
||||
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_ADD(NOW(), INTERVAL 1 DAY)
|
||||
ORDER BY eps.id DESC
|
||||
')
|
||||
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
|
||||
%-->
|
||||
<!--% hpr_shows_to_count = query_hpr_show_count.execute(id); %-->
|
||||
<!--% hpr_shows = query_hpr_shows.execute(id); %-->
|
||||
<!--% hpr_shows = results_hpr_shows.execute(id); %-->
|
||||
<!--% hpr_show_count = 0 %-->
|
||||
<!--% FOREACH show IN hpr_shows_to_count %-->
|
||||
<!--% hpr_show_count = hpr_show_count +1; %-->
|
||||
|
18
templates/queries-correspondent-mysql.tpl.html
Normal file
18
templates/queries-correspondent-mysql.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_ADD(NOW(), INTERVAL 1 DAY)
|
||||
ORDER BY eps.id DESC
|
||||
'
|
||||
%-->
|
Reference in New Issue
Block a user