Put sql in heredoc for better readability
This commit is contained in:
parent
9d825a55b3
commit
0c1c4aa27d
1 changed files with 14 additions and 13 deletions
|
@ -172,20 +172,21 @@ class Application_Model_Schedule
|
||||||
public static function GetLastScheduleItem($p_timeNow)
|
public static function GetLastScheduleItem($p_timeNow)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$sql = "SELECT"
|
$sql = <<<SQL
|
||||||
." ft.artist_name, ft.track_title,"
|
SELECT ft.artist_name,
|
||||||
." st.starts as starts, st.ends as ends"
|
ft.track_title,
|
||||||
." FROM $CC_CONFIG[scheduleTable] st"
|
st.starts AS starts,
|
||||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
st.ends AS ends
|
||||||
." ON st.file_id = ft.id"
|
FROM $CC_CONFIG[scheduleTable] st
|
||||||
." LEFT JOIN $CC_CONFIG[showInstances] sit"
|
LEFT JOIN $CC_CONFIG[filesTable] ft ON st.file_id = ft.id
|
||||||
." ON st.instance_id = sit.id"
|
LEFT JOIN $CC_CONFIG[showInstances] sit ON st.instance_id = sit.id
|
||||||
." WHERE st.ends < TIMESTAMP :timeNow"
|
-- this and the next line are necessary since we can overbook shows.
|
||||||
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
|
WHERE st.ends < TIMESTAMP :timeNow
|
||||||
." AND st.starts < sit.ends"
|
|
||||||
." ORDER BY st.ends DESC"
|
|
||||||
." LIMIT 1";
|
|
||||||
|
|
||||||
|
AND st.starts >= sit.starts
|
||||||
|
AND st.starts < sit.ends
|
||||||
|
ORDER BY st.ends DESC LIMIT 1;
|
||||||
|
SQL;
|
||||||
$row = Application_Common_Database::prepareAndExecute($sql, array(':timeNow'=>$p_timeNow));
|
$row = Application_Common_Database::prepareAndExecute($sql, array(':timeNow'=>$p_timeNow));
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue