Bug #1237 How to easily implementate triggers
Submitted: 10 Sep 2003 0:08 Modified: 4 Aug 2005 21:11
Reporter: yashka judge Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S4 (Feature request)
Version: OS:
Assigned to: CPU Architecture:Any

[10 Sep 2003 0:08] yashka judge
Description:
Let me use DLL functions as triggers. Just design a simple interface to
call DLL functions and pass few parameters to it that will describe, which table and which row was modified and in what way. On Unix this might be dynamically loaded modules ".so". You might also include a connection handle as a parameter. This will rock.

Also the callback can be a executeble file name when the performance is not critical, for instance when a number of records excedes 10000 I want an email sent to me. This will be nice for calling Perl and PHP scripts, or shell scripts or executables - and will give a reasonable performance in many cases.

A great way is to use an installable callbacks, so I start my daemon, and one of lines it executes during start is something like:
 
 mysql_install_trigger(mycallback_addr, trigger_options_struct_addr);

Then the trigger (defined in the trigger_options_struct) will call mycallback() when switched. 

The interesting combination can be that one trigger starts up a daemon that starts up other triggers as installable callbacks - which will give a better performance.

This all eliminates the need for MySQL scripting language and gives a power of triggering into developers hands.

Yakov Sudeikin
exebook.com

How to repeat:
this is a feature request dude..
[4 Aug 2005 21:11] Jim Winstead
Triggers are available in MySQL 5.0, and you can use them to call UDFs.