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