cc-4347: PDO'd: GetLastShowInstance
This commit is contained in:
parent
737c3fcbae
commit
57aae73074
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue