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 > something like a trigger!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
something like a trigger!

Réponse
 
LinkBack Outils de la discussion
Vieux 04/10/2007, 10h18   #1
zoot
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut something like a trigger!

Hello,

I am running a Mysql 5.0.20a.
The database I am building now will contains information about musique
records hold on various support, CD, vinyl tapes...
I would that when somebody insert a new records in the table
'records', that a 'trigger' does a 'lookup' into another table
( media ) to verify that the support already exist, and that the
syntax used is valid.
the table records hold infromation on the musiques (authors,
executant, orchestre...) while media hold informations on support type
(CD, 33tour, 45 Tour (vinyl).. ) the table srecors hold a pointer to
the media table.
I have tried the trigger available in Mysql, but seems that It can
only use column existing in the table where the trigger has been
decalred and as no way to access any other table.
It can't even call a stored procedure nor a function.
Does somebody have an idea how to simulate this?
I am currently implementing this at the PHP level, but shouldn't that
be at the database level?
Kind regards
Zoot

  Réponse avec citation
Vieux 04/10/2007, 12h50   #2
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: something like a trigger!

On 4 Oct, 10:18, zoot <a...@swing.be> wrote:
> Hello,
>
> I am running a Mysql 5.0.20a.
> The database I am building now will contains information about musique
> records hold on various support, CD, vinyl tapes...
> I would that when somebody insert a new records in the table
> 'records', that a 'trigger' does a 'lookup' into another table
> ( media ) to verify that the support already exist, and that the
> syntax used is valid.
> the table records hold infromation on the musiques (authors,
> executant, orchestre...) while media hold informations on support type
> (CD, 33tour, 45 Tour (vinyl).. ) the table srecors hold a pointer to
> the media table.
> I have tried the trigger available in Mysql, but seems that It can
> only use column existing in the table where the trigger has been
> decalred and as no way to access any other table.
> It can't even call a stored procedure nor a function.
> Does somebody have an idea how to simulate this?
> I am currently implementing this at the PHP level, but shouldn't that
> be at the database level?
> Kind regards
> Zoot


Verifying that the support exists as a record in another table is done
with a foreign key constraint.

  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 11h54.


É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,11486 seconds with 10 queries