MySQL and control restrictions

I have inherited an application that uses MySQL and which is used by the PHP interface. The guy who wrote this system went over some fairly complicated lengths to ensure that the codes that users enter are valid - and tat means these codes also exist in another table.

When I first saw this, I wondered why he did not use the CHECK restrictions, and let dbms sort it - I have the look of loading different programs that implement the same checks, and not just one place in dbms. And then I found out that MySQL does not support constraint checking (not strictly true - it supports syntax, but just ignores it).

Is there any way I can implement Check Constraints in MySQL?

Any hints, suggestions, etc. would be wonderful.

+5
source share
1 answer

You can implement something similar to them using triggers, but MySQL itself does not support CHECK restrictions. Do not worry, this will allow you to identify them and just ignore them!

+4
source

All Articles