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