cc-4347: PDO
This commit is contained in:
parent
c1bc50c1db
commit
0838e31094
|
@ -1063,20 +1063,46 @@ SQL;
|
||||||
* In both cases (new and edit) we only grab shows that
|
* In both cases (new and edit) we only grab shows that
|
||||||
* are scheduled 2 days prior
|
* are scheduled 2 days prior
|
||||||
*/
|
*/
|
||||||
|
$se = $show_end->format('Y-m-d H:i:s');
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
|
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
|
||||||
where (ends <= '{$show_end->format('Y-m-d H:i:s')}'
|
where (ends <= '{$show_end->format('Y-m-d H:i:s')}'
|
||||||
or starts <= '{$show_end->format('Y-m-d H:i:s')}')
|
or starts <= '{$show_end->format('Y-m-d H:i:s')}')
|
||||||
and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days')
|
and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days')
|
||||||
and modified_instance = false and id != ".$instanceId. " order by ends";
|
and modified_instance = false and id != ".$instanceId. " order by ends";
|
||||||
|
$stmt = $con->prepare("SELECT id, starts, ends FROM :showInstances
|
||||||
|
where (ends <= :show_end1
|
||||||
|
or starts <= :show_end2)
|
||||||
|
and date(starts) >= (date(:show_end3) - INTERVAL '2 days')
|
||||||
|
and modified_instance = false and id != :instanceId order by ends");
|
||||||
|
$stmt->execute(array(
|
||||||
|
':showInstances' => $CC_CONFIG['showInstances'],
|
||||||
|
':show_end1' => $se,
|
||||||
|
':show_end2' => $se,
|
||||||
|
':show_end3' => $se,
|
||||||
|
':instanceId' => $instanceId
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
|
// TODO : Remove raw sql later
|
||||||
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
|
$sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]."
|
||||||
where (ends <= '{$show_end->format('Y-m-d H:i:s')}'
|
where (ends <= '{$show_end->format('Y-m-d H:i:s')}'
|
||||||
or starts <= '{$show_end->format('Y-m-d H:i:s')}')
|
or starts <= '{$show_end->format('Y-m-d H:i:s')}')
|
||||||
and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days')
|
and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days')
|
||||||
and modified_instance = false order by ends";
|
and modified_instance = false order by ends";
|
||||||
|
$stmt = $con->prepare("SELECT id, starts, ends FROM :showInstances
|
||||||
|
where (ends <= :show_end1
|
||||||
|
or starts <= :show_end2)
|
||||||
|
and date(starts) >= (date(:show_end3) - INTERVAL '2 days')
|
||||||
|
and modified_instance = false order by ends");
|
||||||
|
$stmt->execute(array(
|
||||||
|
':showInstances' => $CC_CONFIG['showInstances'],
|
||||||
|
':show_end1' => $se,
|
||||||
|
':show_end2' => $se,
|
||||||
|
':show_end3' => $se,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
$rows = $con->query($sql);
|
//$rows = $con->query($sql);
|
||||||
|
$rows->fetchAll();
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$start = new DateTime($row["starts"], new DateTimeZone('UTC'));
|
$start = new DateTime($row["starts"], new DateTimeZone('UTC'));
|
||||||
|
|
Loading…
Reference in New Issue