Wednesday 15 January 2014

php - Why should I use MySQL Trigger when I can validate data in application layer -



php - Why should I use MySQL Trigger when I can validate data in application layer -

i don't understand reason of using mysql trigger when can check info in application layer (using php or javascript, instance) , send database. so, cases when have utilize triggers?

i read triggers here: http://www.mysqltutorial.org/sql-triggers.aspx

not sure performance issue talking about. moreover, got wrong; in application level check sanity of info or check malicious data.

whereas, trigger used take action based on triggering event triggering event dml statement (insert/update/delete). triggers not used info validation or sanity checking of data.

again, on note should taken care @ db level; should passed db.

for example, in application level may check entered age not text , should number in trigger check input age in specific range (say, age <= 100) , action based on check.

php mysql triggers database-performance

No comments:

Post a Comment