PostgreSQL compatibility: suppress JOIN in DELETE
This commit is contained in:
parent
63837ebd55
commit
5f1825179a
@ -87,15 +87,10 @@ while($dsondage = $sondage->FetchNextObject(false)) {
|
|||||||
// On inclut la routine de suppression
|
// On inclut la routine de suppression
|
||||||
$date=date('H:i:s d/m/Y');
|
$date=date('H:i:s d/m/Y');
|
||||||
|
|
||||||
$req = 'DELETE s, su, u, c
|
$req = 'DELETE FROM sujet_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' .
|
||||||
FROM
|
'DELETE FROM user_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' .
|
||||||
sondage s LEFT JOIN sujet_studs su
|
'DELETE FROM comments WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' .
|
||||||
ON su.id_sondage = s.id_sondage
|
'DELETE FROM sondage WHERE id_sondage = ' . $connect->Param('id_sondage') ;
|
||||||
LEFT JOIN user_studs u
|
|
||||||
ON u.id_sondage = s.id_sondage
|
|
||||||
LEFT JOIN comments c
|
|
||||||
ON c.id_sondage = s.id_sondage
|
|
||||||
WHERE s.id_sondage = '.$connect->Param('id_sondage');
|
|
||||||
|
|
||||||
$sql = $connect->Prepare($req);
|
$sql = $connect->Prepare($req);
|
||||||
$connect->Execute($sql, array($dsondage->id_sondage));
|
$connect->Execute($sql, array($dsondage->id_sondage));
|
||||||
@ -152,4 +147,4 @@ echo '</html>'."\n";
|
|||||||
|
|
||||||
// si on annule la suppression, rafraichissement de la page
|
// si on annule la suppression, rafraichissement de la page
|
||||||
if (issetAndNoEmpty('annulesuppression') === true) {
|
if (issetAndNoEmpty('annulesuppression') === true) {
|
||||||
}
|
}
|
||||||
|
@ -314,15 +314,11 @@ if (isset($_POST["confirmesuppression"]) || isset($_POST["confirmesuppression_x"
|
|||||||
$date=date('H:i:s d/m/Y:');
|
$date=date('H:i:s d/m/Y:');
|
||||||
|
|
||||||
//destruction des données dans la base SQL
|
//destruction des données dans la base SQL
|
||||||
$sql = 'DELETE s, su, u, c
|
$sql = 'DELETE FROM sujet_studs WHERE id_sondage = ' . $connect->Param('numsondage') . '; ' .
|
||||||
FROM
|
'DELETE FROM user_studs WHERE id_sondage = ' . $connect->Param('numsondage') . '; ' .
|
||||||
sondage s LEFT JOIN sujet_studs su
|
'DELETE FROM comments WHERE id_sondage = ' . $connect->Param('numsondage') . '; ' .
|
||||||
ON su.id_sondage = s.id_sondage
|
'DELETE FROM sondage WHERE id_sondage = ' . $connect->Param('numsondage') ;
|
||||||
LEFT JOIN user_studs u
|
|
||||||
ON u.id_sondage = s.id_sondage
|
|
||||||
LEFT JOIN comments c
|
|
||||||
ON c.id_sondage = s.id_sondage
|
|
||||||
WHERE s.id_sondage = '.$connect->Param('numsondage');
|
|
||||||
$sql = $connect->Prepare($sql);
|
$sql = $connect->Prepare($sql);
|
||||||
if ($connect->Execute($sql, array($numsondage))) {
|
if ($connect->Execute($sql, array($numsondage))) {
|
||||||
// on ecrit dans le fichier de logs la suppression du sondage
|
// on ecrit dans le fichier de logs la suppression du sondage
|
||||||
@ -1257,4 +1253,4 @@ echo '<div class="separateur"> </div>';
|
|||||||
bandeau_pied_mobile();
|
bandeau_pied_mobile();
|
||||||
echo '</form>'."\n";
|
echo '</form>'."\n";
|
||||||
echo '</body>'."\n";
|
echo '</body>'."\n";
|
||||||
echo '</html>'."\n";
|
echo '</html>'."\n";
|
||||||
|
@ -49,16 +49,10 @@ $sondage=$connect->Execute("select * from sondage");
|
|||||||
while ($dsondage=$sondage->FetchNextObject(false)) {
|
while ($dsondage=$sondage->FetchNextObject(false)) {
|
||||||
if ($date_courante > strtotime($dsondage->date_fin)) {
|
if ($date_courante > strtotime($dsondage->date_fin)) {
|
||||||
//destruction des données dans la base
|
//destruction des données dans la base
|
||||||
|
$req = 'DELETE FROM sujet_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' .
|
||||||
$req = 'DELETE s, su, u, c
|
'DELETE FROM user_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' .
|
||||||
FROM
|
'DELETE FROM comments WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' .
|
||||||
sondage s LEFT JOIN sujet_studs su
|
'DELETE FROM sondage WHERE id_sondage = ' . $connect->Param('id_sondage') ;
|
||||||
ON su.id_sondage = s.id_sondage
|
|
||||||
LEFT JOIN user_studs u
|
|
||||||
ON u.id_sondage = s.id_sondage
|
|
||||||
LEFT JOIN comments c
|
|
||||||
ON c.id_sondage = s.id_sondage
|
|
||||||
WHERE s.id_sondage = '.$connect->Param('id_sondage');
|
|
||||||
|
|
||||||
$sql = $connect->Prepare($req);
|
$sql = $connect->Prepare($req);
|
||||||
$connect->Execute($sql, array($dsondage->id_sondage));
|
$connect->Execute($sql, array($dsondage->id_sondage));
|
||||||
@ -66,4 +60,4 @@ while ($dsondage=$sondage->FetchNextObject(false)) {
|
|||||||
// ecriture des traces dans le fichier de logs
|
// ecriture des traces dans le fichier de logs
|
||||||
error_log($date . " SUPPRESSION: $dsondage->id_sondage\t$dsondage->format\t$dsondage->nom_admin\t$dsondage->mail_admin\n", 3, '../admin/logs_studs.txt');
|
error_log($date . " SUPPRESSION: $dsondage->id_sondage\t$dsondage->format\t$dsondage->nom_admin\t$dsondage->mail_admin\n", 3, '../admin/logs_studs.txt');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user