From 0c1c4aa27d85d605b6ca2e6207a59484974da943 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 15:35:30 -0400 Subject: [PATCH] Put sql in heredoc for better readability --- airtime_mvc/application/models/Schedule.php | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 76c0ad6af..5abf081ac 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -172,20 +172,21 @@ class Application_Model_Schedule public static function GetLastScheduleItem($p_timeNow) { global $CC_CONFIG; - $sql = "SELECT" - ." ft.artist_name, ft.track_title," - ." st.starts as starts, st.ends as ends" - ." FROM $CC_CONFIG[scheduleTable] st" - ." LEFT JOIN $CC_CONFIG[filesTable] ft" - ." ON st.file_id = ft.id" - ." LEFT JOIN $CC_CONFIG[showInstances] sit" - ." ON st.instance_id = sit.id" - ." WHERE st.ends < TIMESTAMP :timeNow" - ." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows. - ." AND st.starts < sit.ends" - ." ORDER BY st.ends DESC" - ." LIMIT 1"; + $sql = <<= 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)); return $row;