forked from rho_n/hpr_generator
Convert index page queries from SQLite to MySQL
This commit is contained in:
parent
be1344e10c
commit
aad77f3c78
@ -10,19 +10,20 @@
|
||||
<!--% days_till_next_episode = 0 %-->
|
||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
||||
<!--% FOREACH next_available_episode_result IN DBI.query('
|
||||
WITH next_id AS (SELECT id, id + 1 AS \'id_next\', date as \'last_date\'
|
||||
WITH next_id AS (
|
||||
SELECT id, id + 1 AS \'id_next\', date as \'last_date\'
|
||||
FROM eps
|
||||
WHERE eps.date > date(\'now\')
|
||||
WHERE eps.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\'
|
||||
MIN(next_id.id_next) AS \'next_id\',
|
||||
DATE_FORMAT(MIN(last_date), \'%Y\') AS \'last_year\',
|
||||
DATE_FORMAT(MIN(last_date), \'%d\') AS \'last_day\',
|
||||
DATE_FORMAT(MIN(last_date), \'%m\') AS \'last_month\'
|
||||
FROM next_id
|
||||
LEFT JOIN eps ON next_id.id_next = eps.id
|
||||
WHERE eps.id IS NULL
|
||||
')
|
||||
')
|
||||
%-->
|
||||
<!--% USE date %-->
|
||||
<!--% calc = date.calc %-->
|
||||
@ -65,8 +66,8 @@
|
||||
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
|
||||
WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
|
||||
ORDER BY eps.id DESC
|
||||
LIMIT 10
|
||||
')
|
||||
%-->
|
||||
@ -106,8 +107,8 @@
|
||||
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
|
||||
WHERE eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
|
||||
ORDER BY eps.id DESC
|
||||
LIMIT 30 OFFSET 10
|
||||
')
|
||||
%-->
|
||||
|
Loading…
Reference in New Issue
Block a user