cc-4347: PDO'd: GetLastShowInstance

This commit is contained in:
Rudi Grinberg 2012-09-10 11:06:34 -04:00
parent 737c3fcbae
commit 57aae73074
1 changed files with 10 additions and 15 deletions

View File

@ -754,22 +754,17 @@ SQL;
public static function GetLastShowInstance($p_timeNow)
{
global $CC_CONFIG;
$con = Propel::getConnection();
$sql = <<<SQL
SELECT si.id
FROM cc_show_instances si
WHERE si.ends < :timeNow::TIMESTAMP
AND si.modified_instance = 'f'
ORDER BY si.ends DESC LIMIT 1;
SQL;
$id = Application_Common_Database( $sql, array(
':timeNow' => $p_timeNow ), 'column' );
$sql = "SELECT si.id"
." FROM $CC_CONFIG[showInstances] si"
." WHERE si.ends < TIMESTAMP '$p_timeNow'"
." AND si.modified_instance = 'f'"
." ORDER BY si.ends DESC"
." LIMIT 1";
$id = $con->query($sql)->fetchColumn(0);
if ($id) {
return new Application_Model_ShowInstance($id);
} else {
return null;
}
return ($id ? new Application_Model_ShowInstance($id) : null );
}
public static function GetCurrentShowInstance($p_timeNow)