Archived
4
2

Refactor MySQL database specific SQL

This commit is contained in:
Roan Horning 2022-11-28 22:47:53 -05:00
parent 2b4802508d
commit cb65d25cfc
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769
3 changed files with 15 additions and 6 deletions

View File

@ -0,0 +1,6 @@
<!--% query_call_for_shows = '
SELECT CASE WHEN COUNT(id) < 7 THEN True ELSE False END AS `request_for_shows`
FROM eps
WHERE eps.date > NOW() AND eps.date < DATE_ADD(NOW(), INTERVAL 10 DAY)
'
%-->

View File

@ -0,0 +1,6 @@
<!--% query_call_for_shows = '
SELECT CASE WHEN COUNT(id) < 7 THEN True ELSE False END AS `request_for_shows`
FROM eps
WHERE eps.date > date(\'now\') AND eps.date < date(\'now\', \'+10 days\')
'
%-->

View File

@ -1,12 +1,9 @@
<!--% PROCESS 'shared-utils.tpl.html' %--> <!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-call_for_shows-${constants.database}.tpl.html" %-->
<!--% MACRO display_call_for_shows BLOCK %--> <!--% MACRO display_call_for_shows BLOCK %-->
<!--% query_call_for_shows = DBI.prepare(' <!--% result_call_for_shows = DBI.prepare(query_call_for_shows)
SELECT CASE WHEN COUNT(id) < 7 THEN True ELSE False END AS `request_for_shows`
FROM eps
WHERE eps.date > date(\'now\') AND eps.date < date(\'now\', \'+10 days\')
')
%--> %-->
<!--% results_call_for_shows = query_call_for_shows.execute().get_all() %--> <!--% results_call_for_shows = result_call_for_shows.execute().get_all() %-->
<!--% IF results_call_for_shows.0.request_for_shows == 1 %--> <!--% IF results_call_for_shows.0.request_for_shows == 1 %-->
<!--% USE date %--> <!--% USE date %-->
<article> <article>