From: Ken Youens-Clark Date: Wed, 26 Feb 2003 05:17:49 +0000 (+0000) Subject: Handle "on [delete|update] action" differently X-Git-Tag: v0.01~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=586809da8435c733d2cc5e819be645302b6c0e00;p=dbsrgits%2FSQL-Translator.git Handle "on [delete|update] action" differently --- diff --git a/lib/SQL/Translator/Producer/MySQL.pm b/lib/SQL/Translator/Producer/MySQL.pm index 0ae7ed9..0bf8aa6 100644 --- a/lib/SQL/Translator/Producer/MySQL.pm +++ b/lib/SQL/Translator/Producer/MySQL.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::MySQL; # ------------------------------------------------------------------- -# $Id: MySQL.pm,v 1.6 2003-02-25 05:02:06 kycl4rk Exp $ +# $Id: MySQL.pm,v 1.7 2003-02-26 05:17:49 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -24,7 +24,7 @@ package SQL::Translator::Producer::MySQL; use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use Data::Dumper; @@ -162,8 +162,13 @@ sub produce { ( $match_type =~ /full/i ) ? 'FULL' : 'PARTIAL'; } - $def .= " ON DELETE $on_delete" if $on_delete; - $def .= " ON UPDATE $on_update" if $on_update; + if ( @{ $on_delete || [] } ) { + $def .= ' ON DELETE '.join(' ', @$on_delete); + } + + if ( @{ $on_update || [] } ) { + $def .= ' ON UPDATE '.join(' ', @$on_update); + } push @constraints, $def; }