PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > update in trigger : same table => crash
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
update in trigger : same table => crash

Réponse
 
LinkBack Outils de la discussion
Vieux 05/11/2007, 13h05   #1
slambert
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut update in trigger : same table => crash

Hi everybody

I have a table with two columns (newsletter and journal from the table
mailing) with 0 or 1 as value.

My trouble is that in my new request, if I update or create one of them, I
need to update or create the other with the same value because they are the
same today. And possibly without changing all the existing code of the
existing application. If the user suscribe to one of them, he subscribes to
the two of them. If the user unsucribe for one of them, he has to unsucribe
for the two of them.

So I tried :
1 / a trigger with some test inside : example : IF(
new.newsletter='1' ) THEN UPDATE mailing SET journal=1 WHERE id = new.id;
END IF;

The trouble is my trigger On Update concern the same table as the original
update, and today this just does not work => (Can't update table 'myTable'
in stored function/trigger because it is already used by statement which
invoked this stored function/trigger.)


2 / I tried some test inside before sending the query : exemple IF
(new.newsletter='1' ) THEN SET new.journal='1'; END IF;

The trouble is all existing query does NOT call the 2 columns in the Update
or Insert existing queries. Some of them send only one of them for the
create or the update.

The solution 1 shoud have been OK because this DO work with Oracle, Informix
and Sql Server.

Please don t tell me I will have to go to rewritte all the call in the
existing application : there must be a solution ?

Please ?.........

Cheers

Stéphane


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h59.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08439 seconds with 9 queries