diff Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm @ 271:56364d0c4b4f

+IMPL::SQL::Schema::MySQL: added basic support for MySQL
author cin
date Mon, 28 Jan 2013 02:43:14 +0400
parents 5c82eec23bb6
children 4ddb27ff4a0b
line wrap: on
line diff
--- a/Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm	Fri Jan 25 00:25:02 2013 +0400
+++ b/Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm	Mon Jan 28 02:43:14 2013 +0400
@@ -10,8 +10,8 @@
 
 BEGIN {
     public _direct property referencedPrimaryKey => PROP_GET;
-    public _direct property OnDelete => PROP_GET;
-    public _direct property OnUpdate => PROP_GET;
+    public _direct property onDelete => PROP_GET;
+    public _direct property onUpdate => PROP_GET;
 }
 
 __PACKAGE__->PassThroughArgs;
@@ -20,7 +20,7 @@
 sub CTOR {
     my ($this,%args) = @_;    
     
-    die new Eexception("Referenced table must be an instance of a table object") if not UNIVERSAL::isa($args{'referencedTable'},'IMPL::SQL::Schema::Table');
+    die new Exception("Referenced table must be an instance of a table object") if not is($args{'referencedTable'},'IMPL::SQL::Schema::Table');
     
     die new Exception("Referenced columns must be a not empty list of columns") if not UNIVERSAL::isa($args{'referencedColumns'},'ARRAY') or not scalar(@{$args{'referencedColumns'}});
     
@@ -38,6 +38,9 @@
     $this->{$referencedPrimaryKey} = $ForeingPK;
     
     $ForeingPK->ConnectFK($this);
+    
+    $this->onUpdate($args{onUpdate}) if $args{onUpdate};
+    $this->onDelete($args{onDelete}) if $args{onDelete};
 }
 
 sub Dispose {
@@ -52,8 +55,8 @@
 sub SameValue {
     my ($this,$other) = @_;
     
-    uc $this->OnDelete eq uc $other->OnDelete or return 0;
-    uc $this->OnUpdate eq uc $other->OnUpdate or return 0;
+    uc $this->onDelete eq uc $other->onDelete or return 0;
+    uc $this->onUpdate eq uc $other->onUpdate or return 0;
     
     return $this->SUPER::SameValue($other);
 }