cc-4347: GetNextShowInstance PDO'd.

This commit is contained in:
Rudi Grinberg 2012-09-10 11:25:44 -04:00
parent de86b904a5
commit 53de942c2b
1 changed files with 11 additions and 16 deletions

View File

@ -793,22 +793,17 @@ SQL;
public static function GetNextShowInstance($p_timeNow) public static function GetNextShowInstance($p_timeNow)
{ {
global $CC_CONFIG; $sql = <<<SQL
$con = Propel::getConnection(); SELECT si.id
FROM cc_show_instances si
$sql = "SELECT si.id" WHERE si.starts > :timeNow::TIMESTAMP
." FROM $CC_CONFIG[showInstances] si" AND si.modified_instance = 'f'
." WHERE si.starts > TIMESTAMP '$p_timeNow'" ORDER BY si.starts
." AND si.modified_instance = 'f'" LIMIT 1
." ORDER BY si.starts" SQL;
." LIMIT 1"; $id = Application_Common_Database::prepareAndExecute( $sql,
array( 'timeNow' => $p_timeNow ), 'column' );
$id = $con->query($sql)->fetchColumn(0); return ( $id ? new Application_Model_ShowInstance($id) : null );
if ($id) {
return new Application_Model_ShowInstance($id);
} else {
return null;
}
} }
// returns number of show instances that ends later than $day // returns number of show instances that ends later than $day