IF (@DISABLE_TRIGGER IS NULL AND @DISABLE_TRIGGER_{$tbl} IS NULL ) THEN
";
+ $has_checks= false;
+
foreach($map as $source_col=>$target) {
// check that source_col exists in schema.
if (!isset($this->schema[$tbl][$source_col])) {
END IF;
";
-
+ $has_checks= true;
}
+
$ar = $this->listTriggerFunctions($tbl, 'insert');
foreach($ar as $fn=>$col) {
$trigger .= "
CALL $fn( NEW.{$col});
";
+ $has_checks= true;
}
$trigger .= "
END
";
+
+ if (!$has_checks) {
+ echo "SKIP TRIGGER {$tbl}_before_insert (missing links)\n";
+ return;
+ }
//echo $trigger; exit;
//DB_DAtaObject::debugLevel(1);
$q = DB_DataObject::factory('core_enum');
IF (@DISABLE_TRIGGER IS NULL AND @DISABLE_TRIGGER_{$tbl} IS NULL ) THEN
";
+ $has_checks= false;
+
foreach($map as $source_col=>$target) {
// check that source_col exists in schema.
if (!isset($this->schema[$tbl][$source_col])) {
END IF;
";
+ $has_checks= false;
}
$ar = $this->listTriggerFunctions($tbl, 'update');
foreach($ar as $fn=>$col) {
$trigger .= "
CALL $fn(OLD.{$col}, NEW.{$col});
";
+ $has_checks= false;
}
$trigger .= "
END
";
+ if (!$has_checks) {
+ echo "SKIP TRIGGER {$tbl}_before_update (missing links)\n";
+ return;
+ }
+
//echo $trigger; exit;
//DB_DAtaObject::debugLevel(1);
$q = DB_DataObject::factory('core_enum');