UpdateDatabase/MysqlLinks.php
authorAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 05:00:08 +0000 (13:00 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 05:00:08 +0000 (13:00 +0800)
UpdateDatabase/MysqlLinks.php

index a7ea502..93ba514 100644 (file)
@@ -346,8 +346,36 @@ class Pman_Core_UpdateDatabase_MysqlLinks {
      */
     // type = update/insert/delete
     
-    function listTriggerFunctions($type)
-    
+    function listTriggerFunctions($table, $type)
+    {
+        static $cache = array();
+        if (!isset($cache[$table])) {
+            $cache[$table] = array();
+            $q = DB_DAtaObject::factory('core_enum');
+            $q->query("SELECT
+                            SPECIFIC_NAME
+                        FROM
+                            information_schema.ROUTINES
+                        WHERE
+                            ROUTINE_SCHEMA = '{$q->escape($q->database())}'
+                            AND
+                            ROUTINE_NAME LIKE '" . $q->escape("{$table}_trigger_")  . "%'
+                            AND
+                            ROUTINE_TYPE = 'CALL'
+                            
+            ");
+            while ($q->fetch()) {
+                $cache[$table] = $q->SPECIFIC_NAME;
+            }
+        }
+        // now see which of the procedures match the specification..
+        
+        
+        
+        
+                
+        
+        
     
 }