[Maria-discuss] R: doubt trigger
Standard SQL has triggers FOR EACH STATEMENT, but MariaDB has not. I would use a stored procedure instead. Regards Federico -------------------------------------------- Ven 13/11/15, Roberto Spadim <roberto@spadim.com.br> ha scritto: Oggetto: [Maria-discuss] doubt trigger A: "Maria Discuss" <maria-discuss@lists.launchpad.net> Data: Venerdì 13 novembre 2015, 21:50 hi guy, i'm with a doubt thre's a trigger to execute after insert/update/delete complete? not row by rowi want to change some tables and automatically execute a procedure to recalculate some values, but i will insert/update/delete many rows, that's why i want to execute it after query execution, but with a CALL PROCEDURE() any idea? -- Roberto Spadim -----Segue allegato----- _______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
Hi, Well, I would suggest Flexviews. This is exactly what it is designed for. Or you can roll your own. Assuming the views are based on a single table, create a trigger on the table that logs the changes. You can automate the construction of such a log table and appropriate triggers, but you can't create triggers or stored procedures in a stored procedure, so you have to execute it externally. SUM/COUNT/AVG is easy, but min/max is more difficult, because you might delete the min/max value, and the new min/max isn't in the log. I'd just let flexviews do the job. It handles all the complexity for you. --Justin On Fri, Nov 13, 2015 at 3:02 PM, Federico Razzoli <federico_raz@yahoo.it> wrote:
Standard SQL has triggers FOR EACH STATEMENT, but MariaDB has not. I would use a stored procedure instead.
Regards Federico
-------------------------------------------- Ven 13/11/15, Roberto Spadim <roberto@spadim.com.br> ha scritto:
Oggetto: [Maria-discuss] doubt trigger A: "Maria Discuss" <maria-discuss@lists.launchpad.net> Data: Venerdì 13 novembre 2015, 21:50
hi guy, i'm with a doubt thre's a trigger to execute after insert/update/delete complete? not row by rowi want to change some tables and automatically execute a procedure to recalculate some values, but i will insert/update/delete many rows, that's why i want to execute it after query execution, but with a CALL PROCEDURE() any idea?
-- Roberto Spadim
-----Segue allegato-----
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
participants (2)
-
Federico Razzoli
-
Justin Swanhart